Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store emissions factor data on fabric ledger #64

Closed
sichen1234 opened this issue Jan 21, 2021 · 2 comments
Closed

Store emissions factor data on fabric ledger #64

sichen1234 opened this issue Jan 21, 2021 · 2 comments

Comments

@sichen1234
Copy link
Contributor

Instead of storing emissions factor data in dynamodb or orbitdb, store the emissions factor data directly on fabric ledger. The benefits would be:

  1. Easier installation -- No need to set up either local or cloud based database separately
  2. Emissions factors will be replicated across all nodes
  3. Emissions factors used will be immutably stored and available for later auditing

Add data type field to ledger records to identify if the record is an EMISSIONS_FACTOR or AUDITED_EMISSIONS (or something else eventually)

Initializing data is done by running chain code to store data in ledger as EMISSIONS_FACTOR

Calculating emissions will get data from ledger for EMISSIONS_FACTOR first, then store the calculated results as AUDITED_EMISSIONS.

When storing AUDITED_EMISSIONS, link back to the EMISSIONS_FACTOR record used.

@udosson
Copy link
Member

udosson commented Jan 21, 2021

I agree with all the points listed above. I want to add that this would also be easier to maintain. Instead of updating multiple instances of databases each time some factors change we just have to maintain the chaincode and update the chaincode version on all endorsing peers.

Take a look at the following links to get help in implementing this:
https://hyperledger-fabric.readthedocs.io/en/release/chaincode4ade.html#initializing-the-chaincode
https://github.com/hyperledger/fabric-samples/blob/master/chaincode/fabcar/javascript/lib/fabcar.js#L13

@sichen1234
Copy link
Contributor Author

This is done now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants