diff --git a/chaincode/abstore/node/abstore.js b/chaincode/abstore/javascript/abstore.js similarity index 100% rename from chaincode/abstore/node/abstore.js rename to chaincode/abstore/javascript/abstore.js diff --git a/chaincode/abstore/node/package.json b/chaincode/abstore/javascript/package.json similarity index 100% rename from chaincode/abstore/node/package.json rename to chaincode/abstore/javascript/package.json diff --git a/first-network/byfn.sh b/first-network/byfn.sh index f91f261d9a..5005609db5 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -47,7 +47,7 @@ function printHelp() { echo " -d - delay duration in seconds (defaults to 3)" echo " -f - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -s - the database backend to use: goleveldb (default) or couchdb" - echo " -l - the chaincode language: golang (default) or node" + echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" echo " -o - the consensus-type of the ordering service: solo (default), kafka, or etcdraft" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" echo " -a - launch certificate authorities (no certificate authorities are launched by default)" @@ -61,7 +61,7 @@ function printHelp() { echo " byfn.sh generate -c mychannel" echo " byfn.sh up -c mychannel -s couchdb" echo " byfn.sh up -c mychannel -s couchdb -i 1.4.0" - echo " byfn.sh up -l node" + echo " byfn.sh up -l javascript" echo " byfn.sh down -c mychannel" echo " byfn.sh upgrade -c mychannel" echo @@ -192,7 +192,7 @@ function networkUp() { fi # now run the end to end script - docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE + docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -261,7 +261,7 @@ function upgradeNetwork() { docker-compose $COMPOSE_FILES up -d --no-deps $PEER done - docker exec cli scripts/upgrade_to_v14.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec cli scripts/upgrade_to_v14.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -502,8 +502,8 @@ COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml # certificate authorities compose file COMPOSE_FILE_CA=docker-compose-ca.yaml # -# use golang as the default language for chaincode -LANGUAGE=golang +# use go as the default language for chaincode +CC_SRC_LANGUAGE=go # default image tag IMAGETAG="latest" # default consensus type @@ -552,7 +552,7 @@ while getopts "h?c:t:d:f:s:l:i:o:anv" opt; do IF_COUCHDB=$OPTARG ;; l) - LANGUAGE=$OPTARG + CC_SRC_LANGUAGE=$OPTARG ;; i) IMAGETAG=$(go env GOARCH)"-"$OPTARG diff --git a/first-network/eyfn.sh b/first-network/eyfn.sh index 5ce4a219f1..d6bfab08f2 100755 --- a/first-network/eyfn.sh +++ b/first-network/eyfn.sh @@ -31,7 +31,7 @@ function printHelp () { echo " -d - delay duration in seconds (defaults to 3)" echo " -f - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -s - the database backend to use: goleveldb (default) or couchdb" - echo " -l - the chaincode language: golang (default) or node" + echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" echo " -v - verbose mode" echo @@ -40,7 +40,7 @@ function printHelp () { echo echo " eyfn.sh generate -c mychannel" echo " eyfn.sh up -c mychannel -s couchdb" - echo " eyfn.sh up -l node" + echo " eyfn.sh up -l javascript" echo " eyfn.sh down -c mychannel" echo echo "Taking all defaults:" @@ -112,13 +112,13 @@ function networkUp () { echo "###############################################################" echo "############### Have Org3 peers join network ##################" echo "###############################################################" - docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to have Org3 peers join network" exit 1 fi # finish by running the test - docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to run test" exit 1 @@ -148,7 +148,7 @@ function createConfigTx () { echo "###############################################################" echo "####### Generate and submit config tx to add Org3 #############" echo "###############################################################" - docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to create config tx" exit 1 @@ -237,8 +237,8 @@ COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml # two additional etcd/raft orderers COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml -# use golang as the default language for chaincode -LANGUAGE=golang +# use go as the default language for chaincode +CC_SRC_LANGUAGE=go # default image tag IMAGETAG="latest" @@ -276,7 +276,7 @@ while getopts "h?c:t:d:f:s:l:i:v" opt; do ;; s) IF_COUCHDB=$OPTARG ;; - l) LANGUAGE=$OPTARG + l) CC_SRC_LANGUAGE=$OPTARG ;; i) IMAGETAG=$OPTARG ;; diff --git a/first-network/scripts/script.sh b/first-network/scripts/script.sh index 5d1dc42b6e..b9b1b958ba 100755 --- a/first-network/scripts/script.sh +++ b/first-network/scripts/script.sh @@ -11,29 +11,37 @@ echo "Build your first network (BYFN) end-to-end test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" NO_CHAINCODE="$6" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} : ${NO_CHAINCODE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=20 PACKAGE_ID="" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" -elif [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + 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 + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" else - CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi + echo "Channel name : "$CHANNEL_NAME # import utils @@ -143,7 +151,7 @@ if [ "${NO_CHAINCODE}" != "true" ]; then # Query on chaincode on peer1.org2, check if the result is 90 echo "Querying chaincode on peer1.org2..." chaincodeQuery 1 2 90 - + fi echo diff --git a/first-network/scripts/step1org3.sh b/first-network/scripts/step1org3.sh index 35d097b339..4329860cf6 100755 --- a/first-network/scripts/step1org3.sh +++ b/first-network/scripts/step1org3.sh @@ -13,24 +13,31 @@ CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" -elif [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + 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 + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" else - CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi # import utils diff --git a/first-network/scripts/step2org3.sh b/first-network/scripts/step2org3.sh index 60203292c3..fec4dcc427 100755 --- a/first-network/scripts/step2org3.sh +++ b/first-network/scripts/step2org3.sh @@ -16,25 +16,32 @@ echo "========= Getting Org3 on to your first network ========= " echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 PACKAGE_ID="" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" -elif [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + 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 + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" else - CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi # import utils diff --git a/first-network/scripts/testorg3.sh b/first-network/scripts/testorg3.sh index 693ad32fab..04e23114f9 100755 --- a/first-network/scripts/testorg3.sh +++ b/first-network/scripts/testorg3.sh @@ -22,23 +22,30 @@ echo "Extend your first network (EYFN) test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${TIMEOUT:="10"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" -elif [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + 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 + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" else - CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi echo "Channel name : "$CHANNEL_NAME diff --git a/first-network/scripts/upgrade_to_v14.sh b/first-network/scripts/upgrade_to_v14.sh index 751f111f33..3fb4df685a 100755 --- a/first-network/scripts/upgrade_to_v14.sh +++ b/first-network/scripts/upgrade_to_v14.sh @@ -11,24 +11,31 @@ echo "Upgrade your first network (BYFN) from v1.3.x to v1.4.x end-to-end test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="5"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:]) +CC_SRC_LANGUAGE=$(echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]) COUNTER=1 MAX_RETRY=5 -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" -elif [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + 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 + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" else - CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi echo "Channel name : "$CHANNEL_NAME diff --git a/first-network/scripts/utils.sh b/first-network/scripts/utils.sh index 86060bb528..8807011849 100755 --- a/first-network/scripts/utils.sh +++ b/first-network/scripts/utils.sh @@ -120,7 +120,7 @@ packageChaincode() { ORG=$3 setGlobals $PEER $ORG set -x - peer lifecycle chaincode package mycc.tar.gz --path ${CC_SRC_PATH} --lang ${LANGUAGE} --label mycc_${VERSION} >&log.txt + peer lifecycle chaincode package mycc.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label mycc_${VERSION} >&log.txt res=$? set +x cat log.txt diff --git a/high-throughput/README.md b/high-throughput/README.md index 50b7025a7b..ab7fe54ac5 100644 --- a/high-throughput/README.md +++ b/high-throughput/README.md @@ -114,7 +114,7 @@ and run some invocations are provided below. * Finally, comment out the `docker exec cli scripts/script.sh` command from the `byfn.sh` script by placing a `#` before it so that the standard BYFN end to end script doesn't run, e.g. - `# docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE` + `# docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE` 3. We can now bring our network up by typing in `./byfn.sh up -c mychannel` 4. Open a new terminal window and enter the CLI container using `docker exec -it cli bash`, all operations on the network will happen within diff --git a/scripts/Jenkins_Scripts/byfn_eyfn.sh b/scripts/Jenkins_Scripts/byfn_eyfn.sh index a0d32ddc21..98c02bf052 100755 --- a/scripts/Jenkins_Scripts/byfn_eyfn.sh +++ b/scripts/Jenkins_Scripts/byfn_eyfn.sh @@ -88,25 +88,25 @@ copy_logs $? custom-channel-couch echo y | ./eyfn.sh -m down echo -echo "############### BYFN,EYFN WITH NODE Chaincode. TEST ################" +echo "############### BYFN,EYFN WITH JAVASCRIPT Chaincode. TEST ################" echo "####################################################################" -echo y | ./byfn.sh -m up -l node -t 60 -copy_logs $? default-channel-node -echo y | ./eyfn.sh -m up -l node -t 60 -copy_logs $? default-channel-node +echo y | ./byfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript +echo y | ./eyfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript echo y | ./eyfn.sh -m down echo echo "############### BYFN WITH CA TEST ################" echo "##################################################" -echo y | ./byfn.sh -m up -a -copy_logs $? default-channel-ca +echo y | ./byfn.sh -m up -a +copy_logs $? default-channel-ca echo y | ./byfn.sh -m down -a -echo +echo echo "############### BYFN WITH NO CHAINCODE TEST ################" echo "############################################################" echo y | ./byfn.sh -m up -n copy_logs $? default-channel-ca echo y | ./byfn.sh -m down -n -echo \ No newline at end of file +echo \ No newline at end of file diff --git a/scripts/ci_scripts/byfn_eyfn.sh b/scripts/ci_scripts/byfn_eyfn.sh index 635b07bc27..fc9b8a0160 100755 --- a/scripts/ci_scripts/byfn_eyfn.sh +++ b/scripts/ci_scripts/byfn_eyfn.sh @@ -64,12 +64,12 @@ set +x echo echo " #################################### " -echo -e "\033[1m NODE CHAINCODE\033[0m" +echo -e "\033[1m JAVASCRIPT CHAINCODE\033[0m" echo " # ################################## " set -x -echo y | ./byfn.sh -m up -l node -t 60 -copy_logs $? default-channel-node -echo y | ./eyfn.sh -m up -l node -t 60 -copy_logs $? default-channel-node +echo y | ./byfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript +echo y | ./eyfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript echo y | ./eyfn.sh -m down set +x