You must have completed the prior modules for the commands in this one to work properly, or your account must have been provisioned using our project automation scripts.
At the core of any blockchain network are the logical workflows that are defined in code and executed by its decentralized nodes. Smart contracts is a generic term that has come to be used for this logic, first coined by Nick Szabo in 19891 and popularized by the Ethereum project. In Hyperledger Fabric, this is called chaincode.
Chaincode may be written in Golang, NodeJS and Java. In this module, you will write, test, and deploy chaincode for tracking and managing the state changes that products undergo in the SupplyChain network. After writing and testing the chaincode, you will create a new channel for it to execute in, have each network member join the channel, and then deploy your chaincode to the channel. The following diagram depicts the blockchain network that was set up previously, with chaincode installed on the peer nodes. It also shows that each blockchain member has users that interact with the chaincode based on their permissions.
In this module, each member will write chaincode in NodeJS, ensure that it passes unit tests, join the channel, and install the chaincode on its peers. One member will then instantiate the chaincode on the channel, at which point all members will use their different user identities to invoke the chaincode, in order to update the state of an example product in the supply chain. In the process, we will also learn how to leverage NodeJS libraries in our chaincode.