In this example, we’ll be using the Fabcar Chaincode example provided by Fabric sample. [ https://github.com/hyperledger/fabric-samples/tree/master/chaincode/fabcar/go ] which uses the basic network [ https://github.com/hyperledger/fabric-samples/tree/master/basic-network ] as the Hyperledger Fabric network.
Here I assume that you’ve a good understanding about how Fabric works and how the docker instances for the Fabric network is managed.
Clone the Fabric sample
As the first step, clone the Fabric to your local machine by cloneing it.
git clone https://github.com/hyperledger/fabric-samples cd fabric-samples
Starting the fabric network
In order to start the fabcar chaincode, go into the fabcar folder and run the startFabric.sh
script.
cd fabcard ./startFabric.sh
After this if you want to modify the chaincode and re-deploy you can use the cli
container that is running along with the other services.
The above commands installs a new version of chaincode and upgrades the chaincode by calling the init
function. Make sure you change the CC_VERSION
everytime you call the script to update chaincode.
Also this will create a new image for each version, so make sure you delete the old images to avoid running out of storage.