Programming the initial chaincode skeleton

The first step is to create the skeleton of the chaincode. In order for the validator in VSCode not to mess up your progress, it is best to program the skeleton in one step before saving the file. Add the following code to your file:

package mainimport (  "fmt"  "github.com/hyperledger/fabric/core/chaincode/shim"  pb "github.com/hyperledger/fabric/protos/peer")// InsuranceChaincode smart contract implementation type InsuranceChaincode struct {}

Each chaincode starts with the package declaration. In our case, it is called main. Following this line of code, we need to add a few essential imports, such as "fmt" to print log messages to the console, and most essential, the shim interface and the peer implementation ...

Get Blockchain across Oracle now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.