Starting the chaincode development
Before we can start coding our chaincode, we need to first start up our development environment.
The steps of setting up the development environment has been explained in Chapter 3, Setting the Stage with a Business Scenario. However, we now proceed with starting up the Fabric network in dev-mode. This mode allows us to control how we built and run the chaincode. We will use this network to run our chaincode in the development environment.
Here is how we start the Fabric network in dev mode:
$ cd $GOPATH/src/trade-finance-logistics/network $ ./trade.sh up -d true
If you encounter any error while the network start, it could be caused by some left-over Docker container.
You can resolve this by stopping the network using ./trade.sh down -d true and running the following command: ./trade.sh clean -d true.
The -d true option tells our script to take action on the dev network.
Our development network is now running in four Docker containers. The network is composed of a single orderer, a single peer running in devmode, a chaincode container, and a CLI container. The CLI container creates a blockchain channel named tradechannel at startup. We will use the CLI to interact with the chaincode.
Feel free to inspect the log messages in the logs directory. It lists the components and functions executed during network startup. We will keep the terminal open, as we will receive further log messages here once the chaincode has been installed and invoked.