mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Completely Remove Short Name Support (#390)
Signed-off-by: Julian Castrence <juliancastrence@ibm.com> Co-authored-by: Julian Castrence <juliancastrence@ibm.com>
This commit is contained in:
parent
377ccb0b59
commit
27ac653c74
11 changed files with 41 additions and 66 deletions
|
|
@ -29,7 +29,7 @@ Note that we use the `-ca` flag to deploy the network using certificate authorit
|
|||
|
||||
Run the following command to deploy the auction smart contract. We will override the default endorsement policy to allow any channel member to create an auction without requiring an endorsement from another organization.
|
||||
```
|
||||
./network.sh deployCC -ccn auction -ccp ../auction/chaincode-go/ -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -ccl go
|
||||
./network.sh deployCC -ccn auction -ccp ../auction/chaincode-go/ -ccl go -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
|
||||
```
|
||||
|
||||
## Install the application dependencies
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-basic}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-basic}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-javascript}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-events}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-events}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-ledger}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-ledger-queries}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-private}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-private-data}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cccg ../asset-transfer-private-data/chaincode-go/collections_config.json
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cccg ../asset-transfer-private-data/chaincode-go/collections_config.json
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-typescript}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-sbe}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-sbe}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set -euo pipefail
|
|||
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||
CHAINCODE_NAME=${CHAINCODE_NAME:-secured}
|
||||
CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-secured-agreement}
|
||||
|
||||
function print() {
|
||||
GREEN='\033[0;32m'
|
||||
|
|
@ -15,7 +16,7 @@ function createNetwork() {
|
|||
print "Creating network"
|
||||
./network.sh up createChannel -ca
|
||||
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
|
||||
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccp "${CHAINCODE_PATH}/chaincode-${CHAINCODE_LANGUAGE}" -ccl "${CHAINCODE_LANGUAGE}" -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
|
||||
}
|
||||
|
||||
function stopNetwork() {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pushd ../test-network
|
|||
|
||||
echo "Bring up test network"
|
||||
./network.sh up createChannel -ca
|
||||
./network.sh deployCC -ccn bigdatacc -ccp ../high-throughput/chaincode-go/ -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -ccl go -cci Init
|
||||
./network.sh deployCC -ccn bigdatacc -ccp ../high-throughput/chaincode-go/ -ccl go -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cci Init
|
||||
popd
|
||||
cat <<EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -361,8 +361,8 @@ MAX_RETRY=5
|
|||
CLI_DELAY=3
|
||||
# channel name defaults to "mychannel"
|
||||
CHANNEL_NAME="mychannel"
|
||||
# chaincode name defaults to "basic"
|
||||
CC_NAME="basic"
|
||||
# chaincode name defaults to "NA"
|
||||
CC_NAME="NA"
|
||||
# chaincode path defaults to "NA"
|
||||
CC_SRC_PATH="NA"
|
||||
# endorsement policy defaults to "NA". This would allow chaincodes to use the majority default policy.
|
||||
|
|
@ -382,8 +382,8 @@ COMPOSE_FILE_COUCH_ORG3=addOrg3/docker/docker-compose-couch-org3.yaml
|
|||
# use this as the default docker-compose yaml definition for org3
|
||||
COMPOSE_FILE_ORG3=addOrg3/docker/docker-compose-org3.yaml
|
||||
#
|
||||
# use go as the default language for chaincode
|
||||
CC_SRC_LANGUAGE="go"
|
||||
# chaincode language defaults to "NA"
|
||||
CC_SRC_LANGUAGE="NA"
|
||||
# Chaincode version
|
||||
CC_VERSION="1.0"
|
||||
# Chaincode definition sequence
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ function printHelp() {
|
|||
println
|
||||
println " Flags:"
|
||||
println " -c <channel name> - Name of channel to deploy chaincode to"
|
||||
println " -ccn <name> - Chaincode name. This flag can be used to deploy one of the asset transfer samples to a channel. Sample options: basic (default),ledger, private, sbe, secured"
|
||||
println " -ccl <language> - Programming language of chaincode to deploy: go (default), java, javascript, typescript"
|
||||
println " -ccn <name> - Chaincode name."
|
||||
println " -ccl <language> - Programming language of chaincode to deploy: go, java, javascript, typescript"
|
||||
println " -ccv <version> - Chaincode version. 1.0 (default), v2, version3.x, etc"
|
||||
println " -ccs <sequence> - Chaincode definition sequence. Must be an integer, 1 (default), 2, 3, etc"
|
||||
println " -ccp <path> - (Optional) File path to the chaincode. When provided, the -ccn flag will be used only for the chaincode name."
|
||||
println " -ccp <path> - File path to the chaincode."
|
||||
println " -ccep <policy> - (Optional) Chaincode endorsement policy using signature policy syntax. The default policy requires an endorsement from Org1 and Org2"
|
||||
println " -cccg <collection-config> - (Optional) File path to private data collections configuration file"
|
||||
println " -cci <fcn name> - (Optional) Name of chaincode initialization function. When a function is provided, the execution of init will be requested and the function will be invoked."
|
||||
|
|
@ -94,11 +94,11 @@ function printHelp() {
|
|||
println
|
||||
println " Used with \033[0;32mnetwork.sh deployCC\033[0m"
|
||||
println " -c <channel name> - Name of channel to deploy chaincode to"
|
||||
println " -ccn <name> - Chaincode name. This flag can be used to deploy one of the asset transfer samples to a channel. Sample options: basic (default),ledger, private, sbe, secured"
|
||||
println " -ccl <language> - Programming language of the chaincode to deploy: go (default), java, javascript, typescript"
|
||||
println " -ccn <name> - Chaincode name."
|
||||
println " -ccl <language> - Programming language of the chaincode to deploy: go, java, javascript, typescript"
|
||||
println " -ccv <version> - Chaincode version. 1.0 (default), v2, version3.x, etc"
|
||||
println " -ccs <sequence> - Chaincode definition sequence. Must be an integer, 1 (default), 2, 3, etc"
|
||||
println " -ccp <path> - (Optional) File path to the chaincode. When provided, the -ccn flag will be used only for the chaincode name."
|
||||
println " -ccp <path> - File path to the chaincode."
|
||||
println " -ccep <policy> - (Optional) Chaincode endorsement policy using signature policy syntax. The default policy requires an endorsement from Org1 and Org2"
|
||||
println " -cccg <collection-config> - (Optional) File path to private data collections configuration file"
|
||||
println " -cci <fcn name> - (Optional) Name of chaincode initialization function. When a function is provided, the execution of init will be requested and the function will be invoked."
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
source scriptUtils.sh
|
||||
|
||||
CHANNEL_NAME=${1:-"mychannel"}
|
||||
CC_NAME=${2:-"basic"}
|
||||
CC_SRC_PATH=${3:-"NA"}
|
||||
CC_SRC_LANGUAGE=${4:-"go"}
|
||||
CC_NAME=${2}
|
||||
CC_SRC_PATH=${3}
|
||||
CC_SRC_LANGUAGE=${4}
|
||||
CC_VERSION=${5:-"1.0"}
|
||||
CC_SEQUENCE=${6:-"1"}
|
||||
CC_INIT_FCN=${7:-"NA"}
|
||||
|
|
@ -29,58 +29,27 @@ println "- DELAY: ${C_GREEN}${DELAY}${C_RESET}"
|
|||
println "- MAX_RETRY: ${C_GREEN}${MAX_RETRY}${C_RESET}"
|
||||
println "- VERBOSE: ${C_GREEN}${VERBOSE}${C_RESET}"
|
||||
|
||||
CC_SRC_LANGUAGE=$(echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:])
|
||||
|
||||
FABRIC_CFG_PATH=$PWD/../config/
|
||||
|
||||
# User has not provided a path, therefore the CC_NAME must
|
||||
# be the short name of a known chaincode sample
|
||||
if [ "$CC_SRC_PATH" = "NA" ]; then
|
||||
infoln "Determining the path to the chaincode"
|
||||
# first see which chaincode we have. This will be based on the
|
||||
# short name of the known chaincode sample
|
||||
if [ "$CC_NAME" = "basic" ]; then
|
||||
println $'\e[0;32m'asset-transfer-basic$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-basic"
|
||||
elif [ "$CC_NAME" = "events" ]; then
|
||||
println $'\e[0;32m'asset-transfer-events$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-events"
|
||||
elif [ "$CC_NAME" = "secured" ]; then
|
||||
println $'\e[0;32m'asset-transfer-secured-agreeement$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-secured-agreement"
|
||||
elif [ "$CC_NAME" = "ledger" ]; then
|
||||
println $'\e[0;32m'asset-transfer-ledger-agreeement$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-ledger-queries"
|
||||
elif [ "$CC_NAME" = "private" ]; then
|
||||
println $'\e[0;32m'asset-transfer-private-data$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-private-data"
|
||||
elif [ "$CC_NAME" = "sbe" ]; then
|
||||
println $'\e[0;32m'asset-transfer-sbe$'\e[0m' chaincode
|
||||
CC_SRC_PATH="../asset-transfer-sbe"
|
||||
else
|
||||
fatalln "The chaincode name ${CC_NAME} is not supported by this script. Supported chaincode names are: basic, events, ledger, private, sbe, secured"
|
||||
fi
|
||||
#User has not provided a name
|
||||
if [ -z "$CC_NAME" ] || [ "$CC_NAME" = "NA" ]; then
|
||||
fatalln "No chaincode name was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"
|
||||
|
||||
# now see what language it is written in
|
||||
if [ "$CC_SRC_LANGUAGE" = "go" ]; then
|
||||
CC_SRC_PATH="$CC_SRC_PATH/chaincode-go/"
|
||||
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
||||
CC_SRC_PATH="$CC_SRC_PATH/chaincode-java/"
|
||||
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
||||
CC_SRC_PATH="$CC_SRC_PATH/chaincode-javascript/"
|
||||
elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then
|
||||
CC_SRC_PATH="$CC_SRC_PATH/chaincode-typescript/"
|
||||
fi
|
||||
# User has not provided a path
|
||||
elif [ -z "$CC_SRC_PATH" ] || [ "$CC_SRC_PATH" = "NA" ]; then
|
||||
fatalln "No chaincode path was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"
|
||||
|
||||
# check that the language is available for the sample chaincode
|
||||
if [ ! -d "$CC_SRC_PATH" ]; then
|
||||
fatalln "The smart contract language \"$CC_SRC_LANGUAGE\" is not yet available for the \"$CC_NAME\" sample smart contract"
|
||||
fi
|
||||
## Make sure that the path the chaincode exists if provided
|
||||
# User has not provided a language
|
||||
elif [ -z "$CC_SRC_LANGUAGE" ] || [ "$CC_SRC_LANGUAGE" = "NA" ]; then
|
||||
fatalln "No chaincode language was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"
|
||||
|
||||
## Make sure that the path to the chaincode exists
|
||||
elif [ ! -d "$CC_SRC_PATH" ]; then
|
||||
fatalln "Path to chaincode does not exist. Please provide different path"
|
||||
fatalln "Path to chaincode does not exist. Please provide different path."
|
||||
fi
|
||||
|
||||
CC_SRC_LANGUAGE=$(echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:])
|
||||
|
||||
# do some language specific preparation to the chaincode before packaging
|
||||
if [ "$CC_SRC_LANGUAGE" = "go" ]; then
|
||||
CC_RUNTIME_LANGUAGE=golang
|
||||
|
|
|
|||
Loading…
Reference in a new issue