Setting up the chaincode file

Let's now set up the chaincode file.

We will work with the folder structure cloned from GitHub. The chaincode files are located in the following folder:

$GOPATH/src/trade-finance-logistics/chaincode/src/github.com/trade_workflow_v1

You can either follow the steps and inspect the code files in the folder, or you can create a new folder and create the code files as described.

  1. First, we need to create the chaincode file

In your favorite editor, create a file, tradeWorkflow.go, and include the following package and import statements:

package mainimport (    "fmt"    "errors"    "strconv"    "strings"    "encoding/json"    "github.com/hyperledger/fabric/core/chaincode/shim"    "github.com/hyperledger/fabric/core/chaincode/lib/cid"

Get Blockchain Development with Hyperledger now with O’Reilly online learning.

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