Setting up the development environment

Get the source code of this from the PacktPub GitHub repository if you haven’t already done so. Once you download the source code, navigate to the directory blockchain-by-example/fsc-restful. The example we will run here is based on a Fabric sample project, located at github: https://github.com/hyperledger/fabric-samples.

To run the web application shipped with the book's code, we first need to bring up the Fabric network. We make sure that no other active container is running by using: 

sudo ./script.sh –m down

Then, clear any unused networks:

docker network prune

Navigate to the webapp/ folder and run:

npm install

You'll have to wait for npm to install a few packages. Once the operation is successfully finished, navigate back to the fsc-restful folder, and launch the Fabric network by running:

sudo ./script –m up 

Install the Chaincode, and instantiate it with initial customer order data, before invoking createRowfoodChaincode:

peer Chaincode install -n fsccc -v 1.0 -p "$CC_SRC_PATH" -l "$LANGUAGE"
peer Chaincode instantiate -o orderer.example.com:7050 -C mychannel -n fsccc -l "$LANGUAGE" -v 1.0 -c '{"Args":["init","order_001","John_1","100","5"]}'
peer Chaincode invoke -o orderer.example.com:7050 -C mychannel -n fsccc -c '{"Args":["createRawFood","order_001"]}'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset