From 71e95a799f65b84ac70c49f098672bb4638b75ad Mon Sep 17 00:00:00 2001 From: Vinay Chaudhary Date: Thu, 28 Jun 2018 16:38:00 +0530 Subject: [PATCH 1/3] Update README.md --- README.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2df26ca2..c65603a3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,37 @@ -## Hyperledger Fabric Samples +# Hyperledger Fabric Samples + +First of all start the three terminals. + +## Terminal 1 Start the Fabric Network## +*To start the fabric network on your local machine, First navigate to the chaincode-docker-devmode directory and tag the all images as latest in the docker-compose-simple.yaml file.* + +**docker-compose -f docker-compose-simple.yaml up** + +*Above command download the all required images and start the network with the SingleSampleMSPSolo orderer profile and launches the peer in development mode. It also launches two additional containers one is chaincode and a CLI to interact with the chaincode.Running the command you will see the following* + +>D:\fabric-samples-release-1.1\chaincode-docker-devmode>docker-compose -f docker-compose-simple.yaml up +>Pulling orderer (hyperledger/fabric-orderer:x86_64-1.0.0)... +>x86_64-1.0.0: Pulling from hyperledger/fabric-orderer +>aafe6b5e13de: Pull complete +>0a2b43a72660: Pull complete + +## Terminal 2 Run ChainCode Container. Build and Start ChainCode ## + +**docker exec -it chaincode bash** + +*You should see the following:* + + root@d2629980e76b:/opt/gopath/src/chaincode# + +*Now, compile your chaincode:* + + > .chaincode/sacc# go build + +*Now mention and run the chaincode on the peer:* + +**CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=xyz:0 ./sacc** + -Please visit the [installation instructions](http://hyperledger-fabric.readthedocs.io/en/latest/samples.html). ## License From 6845ca8d31e7412ec13b75f77a6b10119b1d0331 Mon Sep 17 00:00:00 2001 From: Vinay Chaudhary Date: Thu, 28 Jun 2018 16:38:31 +0530 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c65603a3..fc4faca2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ First of all start the three terminals. -## Terminal 1 Start the Fabric Network## +## Terminal 1 Start the Fabric Network ## *To start the fabric network on your local machine, First navigate to the chaincode-docker-devmode directory and tag the all images as latest in the docker-compose-simple.yaml file.* **docker-compose -f docker-compose-simple.yaml up** From 6a563161f8c7b8d368200ad38027917aad46f325 Mon Sep 17 00:00:00 2001 From: Vinay Chaudhary Date: Thu, 28 Jun 2018 17:09:12 +0530 Subject: [PATCH 3/3] Update README.md --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index fc4faca2..a02cc458 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,27 @@ First of all start the three terminals. **CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=xyz:0 ./sacc** +## Terminal 3 - Use the chaincode ## + +We’ll leverage the CLI container to drive these calls. + +**docker exec -it cli bash** + +*You should see the following:* + + root@d2629980e76b:/opt/gopath/src/chaincode# + +**peer chaincode install -p chaincodedev/chaincode/sacc -n xyz -v 0** + +**peer chaincode instantiate -n xyz -v 0 -c '{"Args":["a","50"]}' -C myc** + +*Now issue an invoke to change the value of “a” to “500”.* + +**peer chaincode invoke -n xyz -c '{"Function":"set","Args":["a", "500"]}' -C myc** + +*Finally, query a. We should see a value of 500.* + +**peer chaincode query -n xyz -c '{"Function":"get","Args":["query","a"]}' -C myc** ## License