Compiling and running chaincode

The cloned source code already includes all dependencies using Go vendoring. With that in mind, we can now begin to build the code and to run the chaincode with the following steps:

  1. Compile the chaincode: In a new terminal, connect to the chaincode container and build the chaincode with the following command:
$ docker exec -it chaincode bash 
$ cd trade_workflow_v1 
$ go build 
  1. Run the chaincode with the following command:
$ CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=tw:0 ./trade_workflow_v1  

We now have a running chaincode connected to the peer. The log messages here are indicating that the chaincode is up and running. You can also inspect log messages in the network terminal, which list the connections to the chaincode on the peer.