Last active
May 10, 2019 13:29
-
-
Save aschmidt75/77c292591084598e07703329e730013c to your computer and use it in GitHub Desktop.
Invoke chaincode transactions on Hyperledger Fabric "First-network" example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -ne 1 ]]; then | |
echo 'Usage: cat inputdata.json | ./invoke.sh FUNCTIONNAME' | |
exit 1 | |
fi | |
FUNCTION="$1" | |
INPUTDATA0=`cat` | |
INPUTDATA=$(echo $INPUTDATA0 | sed 's/\"/\\"/g') | |
CRYPTOCONFIG_BASEPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto | |
docker exec cli \ | |
peer chaincode invoke \ | |
-o orderer.example.com:7050 \ | |
--tls true \ | |
--cafile ${CRYPTOCONFIG_BASEPATH}/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem \ | |
--peerAddresses peer0.org1.example.com:7051 \ | |
--tlsRootCertFiles ${CRYPTOCONFIG_BASEPATH}/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt \ | |
--peerAddresses peer0.org2.example.com:9051 \ | |
--tlsRootCertFiles ${CRYPTOCONFIG_BASEPATH}/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt \ | |
-C mychannel \ | |
-n mycc \ | |
-c "{\"Args\":[\"${FUNCTION}\", \"${INPUTDATA}\"]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment