mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-25 19:15:10 +00:00
support deployment of any contract
This commit is contained in:
parent
b26fd5c4fc
commit
47d84bd566
6 changed files with 101 additions and 34 deletions
|
|
@ -31,6 +31,7 @@
|
||||||
export PATH=${PWD}/../bin:${PWD}:$PATH
|
export PATH=${PWD}/../bin:${PWD}:$PATH
|
||||||
export FABRIC_CFG_PATH=${PWD}
|
export FABRIC_CFG_PATH=${PWD}
|
||||||
export VERBOSE=false
|
export VERBOSE=false
|
||||||
|
export NO_CHAINCODE=false
|
||||||
|
|
||||||
# Print the usage message
|
# Print the usage message
|
||||||
function printHelp() {
|
function printHelp() {
|
||||||
|
|
@ -47,6 +48,9 @@ function printHelp() {
|
||||||
echo " -d <delay> - delay duration in seconds (defaults to 3)"
|
echo " -d <delay> - delay duration in seconds (defaults to 3)"
|
||||||
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||||
echo " -l <language> - the programming language of the chaincode to deploy: go (default), javascript, or java"
|
echo " -l <language> - the programming language of the chaincode to deploy: go (default), javascript, or java"
|
||||||
|
echo " -p <chaincode path> - the path of the chaincode to package and deploy"
|
||||||
|
echo " -m <chaincode name> - the name of the chaincode to deploy"
|
||||||
|
echo " -e <chaincode version> - the version of the chaincode to be deployed"
|
||||||
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||||
echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
|
echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
|
||||||
echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)"
|
echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)"
|
||||||
|
|
@ -67,6 +71,10 @@ function printHelp() {
|
||||||
echo " byfn.sh generate"
|
echo " byfn.sh generate"
|
||||||
echo " byfn.sh up"
|
echo " byfn.sh up"
|
||||||
echo " byfn.sh down"
|
echo " byfn.sh down"
|
||||||
|
echo
|
||||||
|
echo "Installing your own chaincode:"
|
||||||
|
echo " byfn.sh up -c mychannel -l javascript -cpath ../../fabric-samples/chaincode/mychaincode -cname mychaincode -version 1"
|
||||||
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ask user for confirmation to proceed
|
# Ask user for confirmation to proceed
|
||||||
|
|
@ -174,7 +182,7 @@ function networkUp() {
|
||||||
echo "Sleeping 15s to allow Raft cluster to complete booting"
|
echo "Sleeping 15s to allow Raft cluster to complete booting"
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
if [ "${NO_CHAINCODE}" != "true" ]; then
|
if [[ "${NO_CHAINCODE}" != "true" ]] && [[ -z "${CC_SRC_PATH}" ]]; then
|
||||||
echo Vendoring Go dependencies ...
|
echo Vendoring Go dependencies ...
|
||||||
pushd ../chaincode/abstore/go
|
pushd ../chaincode/abstore/go
|
||||||
GO111MODULE=on go mod vendor
|
GO111MODULE=on go mod vendor
|
||||||
|
|
@ -183,7 +191,7 @@ function networkUp() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# now run the end to end script
|
# now run the end to end script
|
||||||
docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE
|
docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE $CC_SRC_PATH $CC_NAME $VERSION
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR !!!! Test failed"
|
echo "ERROR !!!! Test failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -465,7 +473,7 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts "h?c:t:d:s:l:i:anv" opt; do
|
while getopts "h?c:t:d:s:l:i:p:m:e:anv" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h | \?)
|
h | \?)
|
||||||
printHelp
|
printHelp
|
||||||
|
|
@ -473,30 +481,51 @@ while getopts "h?c:t:d:s:l:i:anv" opt; do
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
CHANNEL_NAME=$OPTARG
|
CHANNEL_NAME=$OPTARG
|
||||||
|
echo "CHANNEL_NAME: "$CHANNEL_NAME
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
CLI_TIMEOUT=$OPTARG
|
CLI_TIMEOUT=$OPTARG
|
||||||
|
echo "CLI_TIMEOUT: "$CLI_TIMEOUT
|
||||||
;;
|
;;
|
||||||
d)
|
d)
|
||||||
CLI_DELAY=$OPTARG
|
CLI_DELAY=$OPTARG
|
||||||
|
echo "CLI_DELAY: "$CLI_DELAY
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
IF_COUCHDB=$OPTARG
|
IF_COUCHDB=$OPTARG
|
||||||
|
echo "IF_COUCHDB: "$IF_COUCHDB
|
||||||
;;
|
;;
|
||||||
l)
|
l)
|
||||||
CC_SRC_LANGUAGE=$OPTARG
|
CC_SRC_LANGUAGE=$OPTARG
|
||||||
|
echo "CC_SRC_LANGUAGE: "$CC_SRC_LANGUAGE
|
||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
IMAGETAG=$(go env GOARCH)"-"$OPTARG
|
IMAGETAG=$(go env GOARCH)"-"$OPTARG
|
||||||
|
echo "IMAGETAG: "$IMAGETAG
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
CC_SRC_PATH=$OPTARG
|
||||||
|
echo "CC_SRC_PATH: "$CC_SRC_PATH
|
||||||
|
;;
|
||||||
|
m)
|
||||||
|
CC_NAME=$OPTARG
|
||||||
|
echo "CC_NAME: "$CC_NAME
|
||||||
|
;;
|
||||||
|
e)
|
||||||
|
VERSION=$OPTARG
|
||||||
|
echo "VERSION: "$VERSION
|
||||||
;;
|
;;
|
||||||
a)
|
a)
|
||||||
CERTIFICATE_AUTHORITIES=true
|
CERTIFICATE_AUTHORITIES=true
|
||||||
|
echo "CERTIFICATE_AUTHORITIES: "$CERTIFICATE_AUTHORITIES
|
||||||
;;
|
;;
|
||||||
n)
|
n)
|
||||||
NO_CHAINCODE=true
|
NO_CHAINCODE=true
|
||||||
|
echo "NO_CHAINCODE: "$NO_CHAINCODE
|
||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
|
echo "VERBOSE: "$VERBOSE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
||||||
7
first-network/scripts/env.sh
Executable file
7
first-network/scripts/env.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export CHANNEL_NAME=channel1
|
||||||
|
export CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||||
|
export ORG1TLS=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||||
|
export ORG2TLS=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||||
|
|
||||||
8
first-network/scripts/org1.sh
Executable file
8
first-network/scripts/org1.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Environment variables for PEER0 in Org1
|
||||||
|
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
|
||||||
|
CORE_PEER_LOCALMSPID="Org1MSP"
|
||||||
|
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||||
|
|
||||||
8
first-network/scripts/org2.sh
Executable file
8
first-network/scripts/org2.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Environment variables for PEER0 in Org2
|
||||||
|
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
||||||
|
CORE_PEER_ADDRESS=peer0.org2.example.com:9051
|
||||||
|
CORE_PEER_LOCALMSPID="Org2MSP"
|
||||||
|
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||||
|
|
||||||
|
|
@ -15,32 +15,47 @@ CC_SRC_LANGUAGE="$3"
|
||||||
TIMEOUT="$4"
|
TIMEOUT="$4"
|
||||||
VERBOSE="$5"
|
VERBOSE="$5"
|
||||||
NO_CHAINCODE="$6"
|
NO_CHAINCODE="$6"
|
||||||
|
CC_SRC_PATH="$7"
|
||||||
|
CC_NAME="$8"
|
||||||
|
VERSION="$9"
|
||||||
: ${CHANNEL_NAME:="mychannel"}
|
: ${CHANNEL_NAME:="mychannel"}
|
||||||
: ${DELAY:="3"}
|
: ${DELAY:="3"}
|
||||||
: ${CC_SRC_LANGUAGE:="go"}
|
: ${CC_SRC_LANGUAGE:="go"}
|
||||||
: ${TIMEOUT:="10"}
|
: ${TIMEOUT:="10"}
|
||||||
: ${VERBOSE:="false"}
|
: ${VERBOSE:="false"}
|
||||||
: ${NO_CHAINCODE:="false"}
|
: ${NO_CHAINCODE:="false"}
|
||||||
|
: ${CC_NAME:="mycc"}
|
||||||
|
: ${VERSION:="1"}
|
||||||
CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]`
|
CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]`
|
||||||
COUNTER=1
|
COUNTER=1
|
||||||
MAX_RETRY=20
|
MAX_RETRY=20
|
||||||
PACKAGE_ID=""
|
PACKAGE_ID=""
|
||||||
|
|
||||||
|
echo "script.sh inputs: "$1 $2 $3 $4 $5 $6 $7 $8 $9
|
||||||
|
|
||||||
|
# set chaincode runtime language
|
||||||
if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then
|
if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then
|
||||||
CC_RUNTIME_LANGUAGE=golang
|
CC_RUNTIME_LANGUAGE=golang
|
||||||
CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/"
|
|
||||||
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
||||||
CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js
|
CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js
|
||||||
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/"
|
|
||||||
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
||||||
CC_RUNTIME_LANGUAGE=java
|
CC_RUNTIME_LANGUAGE=java
|
||||||
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/"
|
|
||||||
else
|
else
|
||||||
echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script
|
echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script
|
||||||
echo Supported chaincode languages are: go, javascript, java
|
echo Supported chaincode languages are: go, javascript, java
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set chaincode src path to use default contract, if not provided
|
||||||
|
if [-z "$CC_SRC_PATH"]; then
|
||||||
|
if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then
|
||||||
|
CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/"
|
||||||
|
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
||||||
|
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/"
|
||||||
|
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
||||||
|
CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Channel name : "$CHANNEL_NAME
|
echo "Channel name : "$CHANNEL_NAME
|
||||||
|
|
||||||
|
|
@ -95,7 +110,7 @@ updateAnchorPeers 0 2
|
||||||
if [ "${NO_CHAINCODE}" != "true" ]; then
|
if [ "${NO_CHAINCODE}" != "true" ]; then
|
||||||
|
|
||||||
## at first we package the chaincode
|
## at first we package the chaincode
|
||||||
packageChaincode 1 0 1
|
packageChaincode "${VERSION}" 0 1
|
||||||
|
|
||||||
## Install chaincode on peer0.org1 and peer0.org2
|
## Install chaincode on peer0.org1 and peer0.org2
|
||||||
echo "Installing chaincode on peer0.org1..."
|
echo "Installing chaincode on peer0.org1..."
|
||||||
|
|
@ -107,7 +122,7 @@ if [ "${NO_CHAINCODE}" != "true" ]; then
|
||||||
queryInstalled 0 1
|
queryInstalled 0 1
|
||||||
|
|
||||||
## approve the definition for org1
|
## approve the definition for org1
|
||||||
approveForMyOrg 1 0 1
|
approveForMyOrg "${VERSION}" 0 1
|
||||||
|
|
||||||
## check whether the chaincode definition is ready to be committed
|
## check whether the chaincode definition is ready to be committed
|
||||||
## expect org1 to have approved and org2 not to
|
## expect org1 to have approved and org2 not to
|
||||||
|
|
@ -115,42 +130,42 @@ if [ "${NO_CHAINCODE}" != "true" ]; then
|
||||||
checkCommitReadiness 1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": false"
|
checkCommitReadiness 1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": false"
|
||||||
|
|
||||||
## now approve also for org2
|
## now approve also for org2
|
||||||
approveForMyOrg 1 0 2
|
approveForMyOrg "${VERSION}" 0 2
|
||||||
|
|
||||||
## check whether the chaincode definition is ready to be committed
|
## check whether the chaincode definition is ready to be committed
|
||||||
## expect them both to have approved
|
## expect them both to have approved
|
||||||
checkCommitReadiness 1 0 1 "\"Org1MSP\": true" "\"Org2MSP\": true"
|
checkCommitReadiness "${VERSION}" 0 1 "\"Org1MSP\": true" "\"Org2MSP\": true"
|
||||||
checkCommitReadiness 1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": true"
|
checkCommitReadiness "${VERSION}" 0 2 "\"Org1MSP\": true" "\"Org2MSP\": true"
|
||||||
|
|
||||||
## now that we know for sure both orgs have approved, commit the definition
|
## now that we know for sure both orgs have approved, commit the definition
|
||||||
commitChaincodeDefinition 1 0 1 0 2
|
commitChaincodeDefinition "${VERSION}" 0 1 0 2
|
||||||
|
|
||||||
## query on both orgs to see that the definition committed successfully
|
## query on both orgs to see that the definition committed successfully
|
||||||
queryCommitted 1 0 1
|
queryCommitted "${VERSION}" 0 1
|
||||||
queryCommitted 1 0 2
|
queryCommitted "${VERSION}" 0 2
|
||||||
|
|
||||||
# invoke init
|
# invoke init
|
||||||
chaincodeInvoke 1 0 1 0 2
|
#chaincodeInvoke 1 0 1 0 2
|
||||||
|
|
||||||
# Query chaincode on peer0.org1
|
# Query chaincode on peer0.org1
|
||||||
echo "Querying chaincode on peer0.org1..."
|
# echo "Querying chaincode on peer0.org1..."
|
||||||
chaincodeQuery 0 1 100
|
# chaincodeQuery 0 1 100
|
||||||
|
|
||||||
# Invoke chaincode on peer0.org1 and peer0.org2
|
# Invoke chaincode on peer0.org1 and peer0.org2
|
||||||
echo "Sending invoke transaction on peer0.org1 peer0.org2..."
|
# echo "Sending invoke transaction on peer0.org1 peer0.org2..."
|
||||||
chaincodeInvoke 0 0 1 0 2
|
# chaincodeInvoke 0 0 1 0 2
|
||||||
|
|
||||||
# Query chaincode on peer0.org1
|
# Query chaincode on peer0.org1
|
||||||
echo "Querying chaincode on peer0.org1..."
|
# echo "Querying chaincode on peer0.org1..."
|
||||||
chaincodeQuery 0 1 90
|
# chaincodeQuery 0 1 90
|
||||||
|
|
||||||
## Install chaincode on peer1.org2
|
## Install chaincode on peer1.org2
|
||||||
echo "Installing chaincode on peer1.org2..."
|
echo "Installing chaincode on peer1.org2..."
|
||||||
installChaincode 1 2
|
installChaincode 1 2
|
||||||
|
|
||||||
# Query on chaincode on peer1.org2, check if the result is 90
|
# Query on chaincode on peer1.org2, check if the result is 90
|
||||||
echo "Querying chaincode on peer1.org2..."
|
# echo "Querying chaincode on peer1.org2..."
|
||||||
chaincodeQuery 1 2 90
|
# chaincodeQuery 1 2 90
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ packageChaincode() {
|
||||||
ORG=$3
|
ORG=$3
|
||||||
setGlobals $PEER $ORG
|
setGlobals $PEER $ORG
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode package mycc.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label mycc_${VERSION} >&log.txt
|
peer lifecycle chaincode package ${CC_NAME}.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label ${CC_NAME}_${VERSION} >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
cat log.txt
|
cat log.txt
|
||||||
|
|
@ -135,7 +135,7 @@ installChaincode() {
|
||||||
ORG=$2
|
ORG=$2
|
||||||
setGlobals $PEER $ORG
|
setGlobals $PEER $ORG
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode install mycc.tar.gz >&log.txt
|
peer lifecycle chaincode install ${CC_NAME}.tar.gz >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
cat log.txt
|
cat log.txt
|
||||||
|
|
@ -170,11 +170,11 @@ approveForMyOrg() {
|
||||||
|
|
||||||
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode approveformyorg --channelID $CHANNEL_NAME --name mycc --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt
|
peer lifecycle chaincode approveformyorg --channelID $CHANNEL_NAME --name ${CC_NAME} --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt
|
||||||
set +x
|
set +x
|
||||||
else
|
else
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode approveformyorg --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name mycc --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt
|
peer lifecycle chaincode approveformyorg --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name ${CC_NAME} --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt
|
||||||
set +x
|
set +x
|
||||||
fi
|
fi
|
||||||
cat log.txt
|
cat log.txt
|
||||||
|
|
@ -196,12 +196,12 @@ commitChaincodeDefinition() {
|
||||||
# it using the "-o" option
|
# it using the "-o" option
|
||||||
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt
|
peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID $CHANNEL_NAME --name ${CC_NAME} $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
else
|
else
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode commit -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt
|
peer lifecycle chaincode commit -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name ${CC_NAME} $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
fi
|
fi
|
||||||
|
|
@ -230,7 +230,7 @@ checkCommitReadiness() {
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
echo "Attempting to check the commit readiness of the chaincode definition on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
echo "Attempting to check the commit readiness of the chaincode definition on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --output json --init-required >&log.txt
|
peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name ${CC_NAME} $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --output json --init-required >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
test $res -eq 0 || continue
|
test $res -eq 0 || continue
|
||||||
|
|
@ -271,7 +271,7 @@ queryCommitted() {
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
echo "Attempting to Query committed status on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
echo "Attempting to Query committed status on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
||||||
set -x
|
set -x
|
||||||
peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name mycc >&log.txt
|
peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name ${CC_NAME} >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
test $res -eq 0 && VALUE=$(cat log.txt | grep -o '^Version: [0-9], Sequence: [0-9], Endorsement Plugin: escc, Validation Plugin: vscc')
|
test $res -eq 0 && VALUE=$(cat log.txt | grep -o '^Version: [0-9], Sequence: [0-9], Endorsement Plugin: escc, Validation Plugin: vscc')
|
||||||
|
|
@ -306,7 +306,7 @@ chaincodeQuery() {
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
echo "Attempting to Query peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
echo "Attempting to Query peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs"
|
||||||
set -x
|
set -x
|
||||||
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}' >&log.txt
|
peer chaincode query -C $CHANNEL_NAME -n ${CC_NAME} -c '{"Args":["query","a"]}' >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
test $res -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
|
test $res -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
|
||||||
|
|
@ -435,12 +435,12 @@ chaincodeInvoke() {
|
||||||
# it using the "-o" option
|
# it using the "-o" option
|
||||||
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
|
||||||
set -x
|
set -x
|
||||||
peer chaincode invoke -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt
|
peer chaincode invoke -o orderer.example.com:7050 -C $CHANNEL_NAME -n ${CC_NAME} $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
else
|
else
|
||||||
set -x
|
set -x
|
||||||
peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt
|
peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n ${CC_NAME} $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt
|
||||||
res=$?
|
res=$?
|
||||||
set +x
|
set +x
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue