This package is deprecated and is no longer maintained.
For the latest version or Origin please visit energywebfoundation/origin.
This repository is not designed for productive usage. Instead it should be used for demonstration and learning purposes.
Install the Certificate of Origin: npm install
.
The Certificate of Origin app can be deployed on any ethereum-network
- For testing purposes, we recommend deploying it on a local ganache-rpc
- The app is pre-configured to start ganache with:
npm run start-ganache
- The app is pre-configured to start ganache with:
Deploy contracts to preferred network (default ganache-cli): npm run migrate
Mnemonic : outer moment twin salmon shuffle amused twice evil rapid hotel burst stand
# | Public Key | User |
---|---|---|
0 | 0x3b07f15efb10f29b3fc222fb7e717e9af0cc4243 |
TopAdmin , CoO.sol / Owner, Trader |
1 | 0x71c31ff1faa17b1cb5189fd845e0cca650d215d3 |
UserAdmin , Trader , AssetManager |
2 | 0xcea1c413a570654fa85e78f7c17b755563fec5a5 |
AssetAdmin |
3 | 0x583b3e16a27f3db4bdc4c1a5452eeed14619c8da |
|
4 | 0x33496f621350cea01b18ea5b5c43c6c233c3f72d |
|
5 | 0x51ba6877a2c4580d50f7ceece02e2f24e78ef123 |
|
6 | 0xfeebf1e463e39d09d5f8a40a6ed08d604ab01360 |
|
7 | 0x585cc5c7829b1fd303ef5c019ed23815a205a59e |
|
8 | 0x343854a430653571b4de6bf2b8c475f828036c30 |
Matcher |
9 | 0x84a2c086ffa013d06285cdd303556ec9be5a1ff7 |
Trader |
10 | 0x00f4af465162c05843ea38d203d37f7aad2e2c17 |
AgreementAdmin |
User | Roles |
---|---|
CoO.sol / Owner |
All Roles (default) |
TopAdmin |
Allowed to onboard new users and their roles, assets, demands, admins |
UserAdmin |
Allowed to onboard new users |
AssetAdmin |
Allowed to onboard new assets |
AgreementAdmin |
Allowed to onboard new agreements |
Trader |
Allowed to trade and buy certificates |
AssetManager |
Allowed to be the owner of an assets |
Matcher |
Allowed to match energy with demands |
- A
TopAdmin
orUserAdmin
can onboard new users with:setUser()
- After, the roles of the users have to be added by either calling:
setRoles()
addRoles()
Electricity Producing Implement
Example: Power Plant
(The procedure for onboarding a producing asset is nearly the same as the consuming ones.)
createAsset()
(Roles:TopAdmin
orAssetAdmin
)- returns your new
assetId
in event
- returns your new
initProducingProperties(uint _assetId,
...)
initGeneral(uint _assetId,
...)
.
(You should recieve a LogAssetFullyInitialized
event including your assetId
)
saveSmartMeterRead()
to log consumed energy
Electricity Consuming Implement Example: Factory
createAsset()
(Roles:TopAdmin
orAssetAdmin
)- returns a new
assetId
in an event
- returns a new
After receiving the assetId
you're able to call the functions:
initGeneral(uint _assetId,
...)
initLocation (uint _assetId,
...)
(You should receive a LogAssetFullyInitialized
event including your assetId
)
saveSmartMeterRead()
to log consumed energy
Electricity Demand
createDemand()
: AsTopAdmin
orAgreementAdmin
- Requires an array with 10 elements for the different properties that are enabled or disabled (see smart contracts).
initGeneralAndCoupling()
initMatchProperties()
initPriceDriving()
The smart contract will require the following:
- The demand can't have both and originator and a specific producing asset
- If the producing asset is enabled, it must exist
- If the consuming asset is enabled, it must exists
- The Matcher's address must have the Matcher's role
Ways to match:
matchCertificate()
: Match an Existing Certificate to ademand
matchDemand()
: Match Produced Energy to ademand
Internally both functions are calling the same functions for checking the compatibility of the demand
and the energy certificate
.
These functions can also be called before a transaction, to check if an error would result:
checkDemandCoupling()
checkDemandGeneral()
checkMatcher()
checkPriceDriving()
Only these certificates can be matched with demands:
Condition | Result |
---|---|
The matching of produced energy with a demand was successfull | A new certificate is created with the buyer as new owner |
The demand is successfully matched with a certificate | The owner gets transfered |
The produced energy does not match any demand | A new certificate will be created with the assetOwner as certificate-owner and an escrow address |