November 2018
Intermediate to advanced
528 pages
13h 21m
English
The Init function is called when the Chaincode is instantiated by the blockchain network for the first time to initialize its internal data. You can think of it as a constructor in other languages (though Go doesn't support constructors).
As we are building Chaincode to manage a food supply chain, we need to start by defining a struct called Food to represent a food asset. The following picture shows the UML representation of a given asset:

As you may guess, OrderId is the order-tracking ID for the entire supply chain. Besides, each entity in the chain will have its unique entity ID and timestamp when it starts processing ...
Read now
Unlock full access