Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@energyweb/origin

energywebfoundation430GPL-3.0-or-later4.0.2TypeScript support: included

null

readme


EnergyWeb
EnergyWeb Origin

Origin is a set of toolkits that together provide a system for issuance and management of Energy Attribute Certificates (EACs). This repository is an entry point to Origin systems. It has a goal of explaining briefly the whole system and providing you with insight and info where to explore next.

Table of Contents

Packages

SDK Releases

Package Stable Canary Description
@energyweb/device-registry npm npm Contracts and client for the Device Registry
@energyweb/market-matcher-core npm npm Matching rules and logic for market-matcher
@energyweb/market npm npm Contracts and client for the Origin Marketplace
@energyweb/origin npm npm Contracts and client Origin Issuer of certificates
@energyweb/origin-backend-client npm npm Client library for off-chain data source
@energyweb/origin-backend npm npm Example backend for storing off-chain meta-data
@energyweb/user-registry npm npm Contracts and client for the User Registry
@energyweb/utils-general npm npm Utilities

Applications, Infrastructure and Demo

Package Description
@energyweb/origin-ui UI for Origin
@energyweb/market-matcher Off-chain agent for demand and supply matching
@energyweb/solar-simulator Solar production and consumption simulator
@energyweb/event-listener Listens to Origin events, triggers actions on-chain and sends notifications
@energyweb/migrations Deployment and configuration utilities

Packages types

Origin monorepo produce 3 types of the packages that are meant to be used in different use-cases:

Stable

Stable Origin SDK packages are created during release branch build.

Install using yarn add @energyweb/{package}

Canary

Canary packages are created during master branch builds. Canary reflects current state of the master branch, they should be a working versions considers as alpha

Install using yarn add @energyweb/{package}@canary

Preview

Preview packages are built on a special preview branch, this is mostly used as interal tool for tests, demos, disussions. Not meant to be used as SDK releses

Install using yarn add @energyweb/{package}@preview

Installation

Make sure have latest yarn package manager installed.

yarn

Build

yarn build

Test

yarn test

Run demo

Make sure you have created a .env file in the root of the monorepo and that all necessary variables are set. Use .env.example as an example of how the .env file should look.

After you have the .env file created, run the following command:

yarn run:origin

Visit the UI at: http://localhost:3000.

Energy Attribute Certificates

Energy Attribute Certificates, or EACs, is an official document which guarantees that produced energy comes from a renewable source. There are different standards that regulate how data is stored and validated. In Europe, this document is called Guarantee of Origin (GO), in North America, it's called Renewable Energy Certificate (REC), and in parts of Asia, Africa, the Middle East, and Latin America governing standard is International REC (I-REC). Standards do vary, but they all share the same core principles.

The main purpose of EACs is to act as an accounting vehicle to prove that consumed energy came from a renewable source. EACs are mostly used to address sustainability reports regarding Scope 2 emissions.

Key modules and components

Overview of architecture

Key repositories

This section lists key entry points to start your journey with Origin.

  1. migrations - repository with build scripts that enable easy deployment of smart contracts to EWC, Volta or a local blockchain. Often used to demo and get to know features and capabilities of Origin.
  2. origin-backend - Origin combines on and off-chain data storage. This repository is used to act as a backend service for off-chain data storage. You'll need this to run migrations (store data), and origin-ui to display stored data.
  3. origin-ui - frontend of the system needed to view data stored in smart contracts (on-chain) and in the backend (off-chain). To interact Origin frontend you'll need MetaMask.

Other components

  1. user-registry - high-level library to interact with user registry. Can be used to i. a. create new user or set user's role in the system.
  2. device-registry - high-level library for creating and managing electricity producing and consuming devices. Depends on user-registry, because only user with Device Manager role can be owner of device.
  3. origin - a heart of Origin systems, contains logic for storing and transferring Energy Attribute Certificates (as a form of unique ERC721 tokens).
  4. market - a library that allows to create demand (for buyers), supply (for sellers) and agreements between buyers and sellers. It also extends the Certificate from origin and creates PurchasableCertificates that can be sold on the marketplace.
  5. market-matcher - the most important part of marketplace, guarantees automatic matching of supply and demand between sellers and buyers. Matching rules can be highly customized and afterwards the algorithm can be tested by running matching simulator.
  6. utils-general - Contains logic for more straightforward interaction with contracts, such as watching events. It is also a base layer for other libraries to build upon. It provides a foundation for things like off-chain data storage that is universal for all entities.
  7. solar-simulator - This service simulates smart-meter readings based on example solar data from whole year in 15-mins intervals. Also allows you to generate the config based on data from public I-REC registry.
  8. event-listener - Event listeners listen to events on the blockchain and react accordingly.

Deployment

For deployment instructions please refer to Deployment wiki page.

Contribution guidelines

If you want to contribute to Origin, be sure to follow classic open source contribution guidelines (described below).

  1. Commiting a change
    • Fork the repository
    • Make a change to repo code
    • Commit the change to the master branch
  2. Pull request
    • Open a pull request from your fork master branch
    • Request code reviews from @Kuzirashi, @JosephBagaric or @kosecki123
    • Once the PR is approved and the build passes, it will be merged to the master branch

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.0.2 (2020-03-16)

Bug Fixes

  • fetch all device smart meter readings only on-demand (0708917)

4.0.1 (2020-03-02)

Note: Version bump only for package @energyweb/origin

4.0.0 (2020-02-12)

chore

  • origin: remove on-chain layer of certificate request (7c7c67b)

BREAKING CHANGES

  • origin: move certificate requests logic off-chain

3.1.4 (2020-02-04)

Note: Version bump only for package @energyweb/origin

3.1.3 (2020-01-31)

Note: Version bump only for package @energyweb/origin

3.1.2 (2020-01-17)

Note: Version bump only for package @energyweb/origin

3.1.1 (2020-01-07)

Note: Version bump only for package @energyweb/origin

3.1.0 (2019-12-20)

Features

  • add region and province form fields to device registration (f71feff)
  • origin: adjust tests for device registry changes (8692920)

3.0.2 (2019-12-19)

Note: Version bump only for package @energyweb/origin

3.0.1 (2019-12-17)

Bug Fixes

  • origin: use default block range when fetching events (bffafbc)

3.0.0 (2019-12-12)

  • [FIX] Backend hash storing (#341) (b239101), closes #341

BREAKING CHANGES

  • Changed the API endpoints from http://example.url/<marketLogicAddress>/<entity>/<id> to http://example.url/<marketLogicAddress>/<entity>/<id>/<offChainDataHash>

  • feat(utils-general): use the new URL structure when fetching off-chain data

  • Changed the API endpoints of the backend from http://example.url/<marketLogicAddress>/<entity>/<id> to http://example.url/<marketLogicAddress>/<entity>/<id>/<offChainDataHash>

  • chore(user-registry): adjust to breaking changes

  • Updated User API endpoints of the backend from http://example.url/<marketLogicAddress>/<entity>/<id> to http://example.url/<marketLogicAddress>/<entity>/<id>/<offChainDataHash>

  • chore(asset-registry): adjust to breaking changes

  • Updated Asset API endpoints of the backend from http://example.url/<marketLogicAddress>/<entity>/<id> to http://example.url/<marketLogicAddress>/<entity>/<id>/<offChainDataHash>

  • chore(origin): fix constructor weird formatting

  • fix(market): storing off-chain data references on-chain

  • New contracts for PurchasableCertificate + Updated Market API endpoints of the backend from http://example.url/<marketLogicAddress>/<entity>/<id> to http://example.url/<marketLogicAddress>/<entity>/<id>/<offChainDataHash>

  • chore(event-listener): more understandable tests

  • fix(event-listener): make scan interval faster for tests

  • feat(origin-backend): use a simpler URL structure

  • The URL structure of the API changed to only store hashes, omitting IDs, entity types and market lookup contracts used previously

  • chore(origin-backend-client): use only POST methods instead of POST and PUT

  • Use the .insert() method instead of .insertOrUpdate()

  • chore(utils-general): use .insert instead of .insertOrUpdate

  • fix(origin-backend): return 200 on POSTing the same entity

  • chore(utils-general): remove abstract getUrl()

  • chore(user-registry): remove specific getUrl()

  • chore(device-registry): remove specific getUrl()

  • chore(origin): remove specific getUrl()

  • chore(market): remove specific getUrl()

  • chore(monorepo): reorder test:serial

  • fix(origin-backend): adjust tests to new POST behaviour

  • chore(monorepo): Add an ADR for simplifying off-chain data storage

2.0.0 (2019-11-26)

Bug Fixes

chore

Features

  • market: add generation time range to the certificate (#255) (e0be305)
  • origin-ui: add loader to request irec modal (#241) (fbcbb19)
  • origin-ui: Add process indicator while executing tx (#256) (21e1649)
  • origin-ui: runtime Docker environment variables (#259) (dc72ec8)

BREAKING CHANGES

  • part of the matcher logic has been moved to market-matcher-logic package

  • chore(origin): semver update. added README.md

  • Certificate logic related to the market moved to market package

1.3.3 (2019-11-11)

Bug Fixes

1.3.2 (2019-10-30)

Note: Version bump only for package @energyweb/origin

1.3.1 (2019-10-30)

Note: Version bump only for package @energyweb/origin

1.3.0 (2019-10-25)

Bug Fixes

  • use npm solc instead of downloading it every time (#170) (e5ef574)

Features

  • backend: Replace testbackend with the new origin-backend (#137) (c428e7d)

1.2.0 (2019-10-23)

Bug Fixes

Features

  • origin-ui: filter, search claimed certificates, bulk claim in inbox (#44) (c80145a)
  • asset/demand location based matching (#46) (00255bd)
  • Automatic demand matching (#41) (d706629)
  • origin-ui: using in-browser private key (#136) (818d2f5)
  • user-registry: User Off-Chain Properties (#15) (b6c2a31)
  • certificate buying flow for matcher (#161) (bb662c3)
  • demand fill tracking (#82) (2948e17)
  • erc-test-contracts (#24) (ad771ab)
  • new demand creation view and asset types integration (#14) (229e68b)
  • setup prettier and lint config for Origin UI (#20) (9cb4486)