Hyperledger Fabric Node SDK Chaincode Lifecycle 2 0
Hyperledger Fabric Node. SDK Chaincode Lifecycle 2. 0 11/23/2020 fabric-client 2. 0 1
Overview The Node. SDK will add new API’s to support fabric lifecycle 2. 0. The existing Chaincode lifecycle API’s will be left untouched to support customers that have not enabled the new capability. 1. 2. 3. 4. 5. 6. setup - create the necessary application objects and chaincode definition package - package the chaincode source artifacts install - push to the network approve for organization - each organization will define a specific chaincode definition commit for channel - channel members will agree to run a specific chaincode definition initialize - start the chaincode container and initialize the chaincode 11/23/2020 fabric-client 2. 0 2
Overview New class to perform chaincode definition and non channel related tasks Chaincode. js • Step 1: Setup • build up a definition within app • Step 2: Package • source code packaged within app • Step 3: Install • send package to peer , save the returned hash 11/23/2020 fabric-client 2. 0 3
Overview New API’s on the channel object for the channel based steps. • uses a Chaincode instance for the definition (name, version, hash, sequence, endorsement policy) Channel. js • Step 4: Approve Chaincode for Organization invoke approve chaincode transaction to the system lifecycle • Step 5: Define Chaincode for Channel invoke commit chaincode transaction to the system lifecycle 11/23/2020 fabric-client 2. 0 4
Overview Use an existing API to initialize on the channel object • Use “init” instead of invoke Channel. js • Step 6: Initialize Invoke “init” transaction to new chaincode 11/23/2020 fabric-client 2. 0 5
Step: 1 - Setup • build the application objects • • • Client Channel Peer Orderer Chaincode • Set the needed attributes • • Endorsement policy Collection configuration Sequence Name / version All organizations will do this step This is a new class, new methods on the chaincode. 11/23/2020 fabric-client 2. 0 6
Step: 2 - Package • Build a tar file from the source code files and metadata files • Available to be sent to other organizations This should only be done by one organization This is a new class, new method on the chaincode. 11/23/2020 fabric-client 2. 0 7
Step: 3 - Install • Send the packaged code to a peer • Save the hash value returned • May have received the package out of band in package step Install must be done on every peer where the chaincode is expected to be executed 11/23/2020 This is a new class, new method on the chaincode. fabric-client 2. 0 8
Step: 4 - Approve for Organization • Send a “approve chaincode definition for organization” chaincode lifecycle transaction to one peer in our organization • Commit the transaction (send to orderer) Each organization will perform this step This is a new API, new method on the channel. 11/23/2020 fabric-client 2. 0 9
Step: 5 - Commit for Channel • Send a “commit definition chaincode for channel” chaincode lifecycle transaction to enough organizations • Commit transaction (send to orderer) Only one organization will do this step This is a new API, new method on the channel. 11/23/2020 fabric-client 2. 0 10
Step: 6 - Initialize the chaincode • Send an endorsement to enough peers • “init” must be the function • Starts the chaincode container and the ”init” method is called with the provided arguments • Commit the transaction Only one organization will do this step 11/23/2020 This is not a new API, existing method on the channel. fabric-client 2. 0 11
- Slides: 11