diff --git a/hyperledger/1.0/README.md b/hyperledger/1.0/README.md index 1fb972f2..bd968ef7 100644 --- a/hyperledger/1.0/README.md +++ b/hyperledger/1.0/README.md @@ -81,7 +81,13 @@ ca046fc3c0e7 hyperledger/fabric-cop "cop server start -ca" 5 minu After the cluster is synced successfully, you can validate by deploying, invoking or querying chaincode from the container or from the host. #### Deploy -```sh +Use `docker exec` to open a bash inside container `fabric-vp0`, which will accept our chaincode testing commands of `deploy`, `invoke` and `query`. + +Run `peer chaincode deploy -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a","100","b","200"]}'` to deploy a new chaincode of the example02. + +This will initialize two accounts: `a` and `b`, with value of `100` and `200`. + +```bash $ docker exec -it fabric-vp0 bash root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode deploy -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a","100","b","200"]}' ``` @@ -89,7 +95,9 @@ root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode deploy -n test_cc There should be no error in the return log, and in the peer nodes's output. #### Query -Query the existing value of `a` and `b`. +Inside the container, query the existing value of `a` and `b`. + +*Notice that the query method is called by invoke a transaction.* ```bash root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode invoke -n test_cc -c '{"Args":["query","a"]}' @@ -123,7 +131,7 @@ ca046fc3c0e7 hyperledger/fabric-cop ``` #### Invoke -Invoke a transaction to transfer `10` from `a` to `b`. +Inside the container, invoke a transaction to transfer `10` from `a` to `b`. ```bash root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode invoke -n test_cc -c '{"Args":["invoke","a","b","10"]}'