Update docs

pull/16/head
Baohua Yang 2017-01-04 15:01:42 +08:00
parent 7bc01335e2
commit a5801392cf
1 changed files with 11 additions and 3 deletions

View File

@ -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. After the cluster is synced successfully, you can validate by deploying, invoking or querying chaincode from the container or from the host.
#### Deploy #### 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 $ 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"]}' 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. There should be no error in the return log, and in the peer nodes's output.
#### Query #### 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 ```bash
root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode invoke -n test_cc -c '{"Args":["query","a"]}' 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
Invoke a transaction to transfer `10` from `a` to `b`. Inside the container, invoke a transaction to transfer `10` from `a` to `b`.
```bash ```bash
root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode invoke -n test_cc -c '{"Args":["invoke","a","b","10"]}' root@vp0:/go/src/github.com/hyperledger/fabric# peer chaincode invoke -n test_cc -c '{"Args":["invoke","a","b","10"]}'