Hyperledger Fabric - Chaincode lifecycle
Hyperledger fabric (HLF) supports multiple technologies in which the chain code can be written. As I write this article, HLF supports chaincodes to be written in Java/ JS/ Go programming languages.
This means that HLF will have to support compilation of three different technologies from a framework standpoint. It is interesting the way it was done in HLF 1.4. The source code is copied onto 'peer docker container' and then the actual code build is triggered within Docker. Once successful, new Docker instances with the chaincode deployed in it is started. Changes to the existing chaincode would be done via the upgrade process.
There is interesting change to the way the chaincode lifecycle is in HLF 2.x which has implications on how the network participants now operate. It is now a four step process of Package, install, approve and commit.
- Package - the chain code is packaged into a deliverable on a build machine (instead of copying original sources to Docker containers).
- Install - The deliverable is copied onto the peers (Docker conatiners)
- Approve - (Unlike in HLF 1.4) Each of the network participant will have to approve this change first before the network admin can complete the delployment on to the HLF network.
- Commit - The chain code is deployed and started as individual containers.
Two important implications here in HLF 2.x are that source code does not float around as part of the DEVOPS automation and network participants can challenge network admin and stop a chaincode upgrade. A more detailed discussion and run down of this process is here in the link below for the interested folks!