Abstract
Use Cactus to implement integration between Fabric application such as the emissions data channel and Ethereum emissions token network:
- Replace the current ethers connection to Ethereum with Cactus to perform "atomic swap" between Ethereum and Fabric. Cactus connector will call Ethereum to tokenize emissions records from Fabric, wait for the Ethereum blocks to record, then come back to Fabric to update the emissions records with the Ethereum token information.
- Instead of putting private key in a config file, use Cactus to integrate with AWS Secret Manager or the open source Vault
- Implement Vault Transit key signing for fabric transaction
Mentor and Mentee
Mentor | Mentor | Mentor | Mentee |
---|---|---|---|
Si Chen US PST sichen@opensourcestrategies.com | Peter Somogyvari US PST peter.somogyvari@accenture.com | Kamlesh Nagware IST kamlesh.nagware@snapperfuturetech.com | Pritam Singh IST pkspritam10@gmail.com |
...
Project repo: https://github.com/hyperledger-labs/blockchain-carbon-accounting/tree/mentorship-cactus-integration
Deliverables
- 1 Cactus Fabric Connector on a feature branch of the carbon accounting tool Cactus Fabric Connector on a feature branch of the carbon accounting tool (proposed)
- 2 Add business logic to the Cactus app that’s still missing (mostly the REST endpoints)
- 3
- 4
- Replace direct dependence of carbon accounting application on fabric-node-sdk and ethers pkg with cactus packages.
- Add Support for signing of HL Fabric Transactions with private key stored as transit key in vault server.
- Prevent double minting of emissions token during `record audited emissions token` operation.
- Vault Identity management server for the carbon accounting application.
Milestones
Eval 1:
- a
- b
- Replace direct dependence of carbon accounting application on fabric-node-sdk and ethers pkg with cactus packages.
Eval 2:
- c
- d
- Add Support for signing of HL Fabric Transactions with private key stored as transit key in vault server.
Eval 3:
- e.fPrevent double minting of emissions token during `record audited emissions token` operation.
Eval 4:
- g.
- h.
- Vault Identity management server for the carbon accounting application.
Timeline
Week | Task/Plan | Deliverable |
---|---|---|
May 24 - May 28 |
|
|
May 31 - June 11 |
|
|
June 14 - June 25 |
|
|
June 28 - July 2 |
|
|
July 5 - July 9 |
Eval 1 |
|
July 12 - July 23 |
|
|
July 26 - August 6 |
|
|
August 9 - August 13 |
|
|
August 16 - August 27 |
Eval 2 |
|
August 30 - Sept 3 |
|
|
Sept 6 - Sept 17 |
|
|
Sept 20 - 24 | ||
Sept 27 - Oct 1 | Eval 3 | |
Oct 4 - Oct 15 |
|
|
Oct 18 - Oct 29 |
|
|
Nov 1 - Nov 5 |
|
|
Nov 8 - Nov 12 | Eval 4 Final evaluation and presentation of project |
...
Github issues macro query labels=mentorship-cactus repo blockchain-carbon-accounting user hyperledger-labs token 4
Explanation
Explanation of the project goes here.
Methodology
...
Replace direct dependence of carbon accounting application on fabric-node-sdk and ethers pkg with cactus packages :
carbon accounting application is a REST API server which connects to multiple ledgers (Ethereum and HL fabric ) to perform required business logic for the carbon accounting project. It was using fabric-node-sdk for making HL fabric transactions and ethers package for ethereum transactions. In order to integrate hypelredger cactus with carbon accounting project, `fabric-node-sdk` is replaced with `@hyperledger/cactus-plugin-ledger-connector-fabric` and `ethers` with `@hyperledger/cactus-plugin-ledger-connector-xdai`
Add Support for signing of HL Fabric Transactions with private key stored as transit key in vault server.
fabric-node-sdk
provide two different kind of approaches for managing client's private key.
storing client's private key and certificate together on some database (which implements wallet interface). For this approach a rough flow goes something like this
- client send request to
org's application
server toinvoke
orquery
chaincode using a giveKEY
. org's application
upon receiving the request , it fetchesprivate key
andcertificate
corresponding toKEY
.- uses the fetched private key to sign fabric
message
in order to query or invoke chaincode.
NOTE : developer of the application has to implement authentication for client'sKEY
- client send request to
store private key in HSM , but in this approach
application
andHSM
have to be present on same physical machine (i.eHSM
should directly be connected withmachine
running the application). This approach is mostly used for developing client's desktop application, which will be responsible for communicating with fabric peers.
- Major Advantage in First approach : clients won't be responsible for communicating with fabric network
- Major Disadvantage in First approach : all private key are stored in single database which leads to Honey
pot
for hackers to exploit . - Major Advantage in Second approach : client's private key are never exposed to
org's
application. - Major Disadvantage in Second approach : clients are responsible for communicating with fabric network
Now comes the fabric-secure-connector
which only brings the advantages from both the approaches. Secure Fabric connector provides a solution to the fabric organization for managing their client's private key such that the client's private key is never brought to Node Server
for singing.
Reference :
- https://github.com/hyperledger/cactus/issues/1212 (proposal to HL Cactus)
- https://github.com/hyperledger/cactus/pull/1243 (PR to HL cactus: feat(connector-fabric): add support for vault transit secret engine)
- https://github.com/hyperledger-labs/blockchain-carbon-accounting/pull/287 (PR : integration of vault signing in carbon accounting application)
Prevent double minting of emissions token during `record audited emissions token` operation.
The `record emissions token` operation requires interaction with both ethereum and fabric network, due to which a problem of double minting of token for same emissions is introduced. To solve this dataLock chaincode is developed.
DataLock Chaincode :
It's a Fabric chaincode for locking fabric data, while transactions related to the locked data are executed on different ledger/dataSource. Use of MVCC (Multiversion concurrency control) makes fabric a perfect blockchain for locking data. In fabric, MVCC is used for the solving double spending problem. DataLock uses the same facts, such that a single process with a unique id can only acquire lock. To minimize number of call to fabric, business logic of data chaincode can be called from DataLock chaincode before locking or unlocking.
Reference :
- More Details : https://github.com/hyperledger-labs/blockchain-carbon-accounting/tree/main/utility-emissions-channel/chaincode/datalock
Vault Identity management server for the carbon accounting application.
Server exposing endpoint for clients to manage their vault identity. Each client is represented a identity inside vault with certain policy rule placed on them. Using this server two type identity can be created.
- Client : Has access to managing one transit key.
- Manager : Identity responsible for create client's identity.
Reference
- More Details : https://github.com/hyperledger-labs/blockchain-carbon-accounting/tree/main/secure-identities/vault-identity
- PR : https://github.com/hyperledger-labs/blockchain-carbon-accounting/pull/326
Methodology
- Design : Each new components/idea is first designed using PlantUML
- Make It Work : This is the first iteration of the design implementation.
- Refactor/Optimise : All the implementation are further refactored and optimised.
- Write Test : For the correctness and maintainability unit, integration and end-to-end test are added to the code base.