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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.