How to use it:
- Clone the repository to
$GOPATH/src/github.com
- Fetch the vendor packages
cd $GOPATH/src/github.com/token/chaincode && govendor fetch github.com/hyperledger/fabric/protos/msp
- Run tests:
cd $GOPATH/src/github.com/token/chaincode && go test
- Install on peers:
peer chaincode install -n token -v 1.0 -p github.com/token/chaincode
- Instantiate on peers:
peer chaincode instantiate -o orderer_address:7050 -C mychannel -n token -v 1.0 -p github.com/token/chaincode -c '{"Args":["init","{\"name\": \"Fabric Demo Token\", \"symbol\": \"FTD\", \"decimals\": 2, \"totalSupply\": 1000}"]}'
- Query balance:
peer chaincode query -C mychannel -n token -c '{"Args":["balance","{\"user\": \"myuser\"}"]}'
- Invoke transfer:
peer chaincode invoke -o orderer_address:7050 -C mychannel -n token -c '{"Args":["transfer","{\"to\": \"otherUser\", \"value\": 200}"]}'