Last active
          April 4, 2019 14:44 
        
      - 
      
- 
        Save aschmidt75/68bc67e76d720bac8240b3de56494e68 to your computer and use it in GitHub Desktop. 
    hyperledger fabric-samples test scripts
  
        
  
    
      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 shipmenttracking \ | |
| -n mycc \ | |
| -c "{\"Args\":[\"${FUNCTION}\", \"${INPUTDATA}\"]}" | 
  
    
      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 | |
| LOGLEVEL=INFO | |
| x_is_on=${-//[^x]/} | |
| if [[ "${x_is_on}" == "x" ]]; then | |
| LOGLEVEL=DEBUG | |
| fi | |
| CARGS="\"invoke\"" | |
| while [[ $# -gt 0 ]]; do | |
| CARGS="${CARGS},\"$1\"" | |
| shift 1 | |
| done | |
| CONFIG_BASEPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto | |
| PEER_ORGNAME=org1.example.com | |
| PEER_HOSTNAME=peer0 | |
| docker exec \ | |
| -e CORE_LOGGING_LEVEL=${LOGLEVEL} \ | |
| -e CORE_PEER_TLS_ENABLED=true \ | |
| -e CORE_PEER_LOCALMSPID=Org1MSP \ | |
| -e CORE_PEER_MSPCONFIGPATH=${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/users/Admin@${PEER_ORGNAME}/msp \ | |
| -e CORE_PEER_ID=cli \ | |
| cli \ | |
| peer chaincode invoke \ | |
| -o orderer.example.com:7050 \ | |
| --tls $CORE_PEER_TLS_ENABLED \ | |
| --cafile ${CONFIG_BASEPATH}/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem \ | |
| -C mychannel \ | |
| -n mycc \ | |
| --peerAddresses ${PEER_HOSTNAME}.${PEER_ORGNAME}:7051 \ | |
| --tlsRootCertFiles ${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/peers/${PEER_HOSTNAME}.${PEER_ORGNAME}/tls/ca.crt \ | |
| --peerAddresses ${PEER_HOSTNAME}.org2.example.com:7051 \ | |
| --tlsRootCertFiles ${CONFIG_BASEPATH}/peerOrganizations/org2.example.com/peers/${PEER_HOSTNAME}.org2.example.com/tls/ca.crt \ | |
| -c '{"Args":['${CARGS}']}' | |
| echo RES: $? | 
  
    
      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 | |
| LOGLEVEL=INFO | |
| x_is_on=${-//[^x]/} | |
| if [[ "${x_is_on}" == "x" ]]; then | |
| LOGLEVEL=DEBUG | |
| fi | |
| CARGS="\"query\"" | |
| while [[ $# -gt 0 ]]; do | |
| CARGS="${CARGS},\"$1\"" | |
| shift 1 | |
| done | |
| CONFIG_BASEPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto | |
| PEER_ORGNAME=org2.example.com | |
| PEER_HOSTNAME=peer0 | |
| docker exec \ | |
| -e CORE_LOGGING_LEVEL=${LOGLEVEL} \ | |
| -e CORE_PEER_TLS_ENABLED=true \ | |
| -e CORE_PEER_TLS_ROOTCERT_FILE=${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/peers/${PEER_HOSTNAME}.${PEER_ORGNAME}/tls/ca.crt \ | |
| -e CORE_PEER_TLS_KEY_FILE=${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/peers/${PEER_HOSTNAME}.${PEER_ORGNAME}/tls/server.key \ | |
| -e CORE_PEER_TLS_CERT_FILE=${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/peers/${PEER_HOSTNAME}.${PEER_ORGNAME}/tls/server.crt \ | |
| -e CORE_PEER_LOCALMSPID=Org2MSP \ | |
| -e CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock \ | |
| -e CORE_PEER_MSPCONFIGPATH=${CONFIG_BASEPATH}/peerOrganizations/${PEER_ORGNAME}/users/Admin@${PEER_ORGNAME}/msp \ | |
| -e CORE_PEER_ID=cli \ | |
| -e CORE_PEER_ADDRESS=${PEER_HOSTNAME}.${PEER_ORGNAME}:7051 \ | |
| cli \ | |
| peer chaincode query \ | |
| -C mychannel \ | |
| -n mycc \ | |
| -c '{"Args":['${CARGS}']}' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment