2017-12-06 22:30:57 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Before running `make`, config this files
|
|
|
|
# Define some global variables for usage. Will be included by func.sh.
|
|
|
|
|
2019-12-28 09:43:08 +08:00
|
|
|
# ARCH=amd64
|
2018-10-11 13:53:01 +08:00
|
|
|
|
2019-04-01 11:10:38 +08:00
|
|
|
# for the base images, including baseimage, couchdb, kafka, zookeeper
|
2019-12-28 09:43:08 +08:00
|
|
|
BASE_IMG_TAG=0.4.18
|
2018-10-11 13:53:01 +08:00
|
|
|
|
|
|
|
# For fabric images, including peer, orderer, ca
|
|
|
|
FABRIC_IMG_TAG=latest
|
|
|
|
|
2019-04-01 16:21:22 +08:00
|
|
|
# Keep the same as in core.yaml, will tag ccenv with this value
|
2019-04-01 11:10:38 +08:00
|
|
|
PROJECT_VERSION=2.0.0
|
2018-10-11 13:53:01 +08:00
|
|
|
|
2020-01-30 02:49:24 +08:00
|
|
|
# for ccenv, baseos, javaenv, nodeenv
|
|
|
|
TWO_DIGIT_VERSION=2.0
|
|
|
|
|
2017-12-06 22:30:57 +08:00
|
|
|
# Name of app channel, need to align with the gen_artifacts.sh
|
|
|
|
SYS_CHANNEL="testchainid"
|
|
|
|
APP_CHANNEL="businesschannel"
|
2019-05-02 17:30:13 +08:00
|
|
|
APP_CHANNEL1="businesschannel1"
|
|
|
|
APP_CHANNEL2="businesschannel2"
|
2017-12-06 22:30:57 +08:00
|
|
|
|
|
|
|
# Client cmd execute timeout and retry times
|
2019-05-02 15:22:34 +08:00
|
|
|
TIMEOUT="90"
|
2018-09-10 14:22:00 +08:00
|
|
|
MAX_RETRY=10
|
2017-12-06 22:30:57 +08:00
|
|
|
|
|
|
|
# Organization and peers
|
|
|
|
ORGS=( 1 2 )
|
|
|
|
PEERS=( 0 1 )
|
2018-01-30 15:54:49 +08:00
|
|
|
#: "${ORGS:=( 1 2 )}"
|
|
|
|
#: "${PEERS:=( 0 1 )}"
|
2017-12-06 22:30:57 +08:00
|
|
|
|
2018-08-27 10:52:46 +08:00
|
|
|
ORG1MSP="Org1MSP"
|
|
|
|
ORG2MSP="Org2MSP"
|
|
|
|
ORG3MSP="Org3MSP"
|
|
|
|
|
2019-05-02 17:30:13 +08:00
|
|
|
# Orderer0 related paths
|
|
|
|
ORDERER0_MSP=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp
|
|
|
|
ORDERER0_ADMIN_MSP=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp
|
|
|
|
ORDERER0_TLS_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
|
|
|
ORDERER0_TLS_ROOTCERT=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/ca.crt
|
|
|
|
|
|
|
|
# Org1 related path
|
2018-08-27 10:52:46 +08:00
|
|
|
ORG1_ADMIN_MSP=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
|
|
|
ORG1_PEER0_MSP=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.Org1.example.com/msp
|
2017-12-19 15:09:40 +08:00
|
|
|
ORG1_PEER0_TLS_ROOTCERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
|
|
|
ORG1_PEER1_TLS_ROOTCERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt
|
2018-08-27 10:52:46 +08:00
|
|
|
ORG1_ADMIN_TLS_CLIENT_KEY=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@Org1.example.com/tls/client.key
|
|
|
|
ORG1_ADMIN_TLS_CLIENT_CERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@Org1.example.com/tls/client.crt
|
|
|
|
ORG1_ADMIN_TLS_CA_CERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@Org1.example.com/tls/ca.crt
|
2019-05-02 17:30:13 +08:00
|
|
|
|
|
|
|
# Org2 related path
|
|
|
|
ORG2_ADMIN_MSP=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
2017-12-19 15:09:40 +08:00
|
|
|
ORG2_PEER0_TLS_ROOTCERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
|
|
|
ORG2_PEER1_TLS_ROOTCERT=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt
|
|
|
|
|
2017-12-06 22:30:57 +08:00
|
|
|
# Node URLS
|
2019-04-21 11:18:26 +08:00
|
|
|
ORDERER0_URL="orderer0.example.com:7050"
|
|
|
|
ORDERER1_URL="orderer1.example.com:7050"
|
|
|
|
ORDERER2_URL="orderer2.example.com:7050"
|
2017-12-06 22:30:57 +08:00
|
|
|
ORG1_PEER0_URL="peer0.org1.example.com:7051"
|
|
|
|
ORG1_PEER1_URL="peer1.org1.example.com:7051"
|
|
|
|
ORG2_PEER0_URL="peer0.org2.example.com:7051"
|
|
|
|
ORG2_PEER1_URL="peer1.org2.example.com:7051"
|
|
|
|
|
2018-01-05 14:37:52 +08:00
|
|
|
# Chaincode exp02 related
|
|
|
|
CC_02_NAME="exp02"
|
|
|
|
CC_02_PATH="examples/chaincode/go/chaincode_example02"
|
2018-01-05 10:53:21 +08:00
|
|
|
CC_02_INIT_ARGS='{"Args":["init","a","100","b","200"]}'
|
|
|
|
CC_02_UPGRADE_ARGS='{"Args":["upgrade","a","100","b","200"]}'
|
|
|
|
CC_02_INVOKE_ARGS='{"Args":["invoke","a","b","10"]}'
|
|
|
|
CC_02_QUERY_ARGS='{"Args":["query","a"]}'
|
2017-12-06 22:30:57 +08:00
|
|
|
|
2018-01-05 14:37:52 +08:00
|
|
|
# Chaincode map related
|
|
|
|
CC_MAP_NAME="map"
|
|
|
|
CC_MAP_PATH="examples/chaincode/go/map"
|
|
|
|
CC_MAP_INIT_ARGS='{"Args":["init",""]}'
|
|
|
|
CC_MAP_UPGRADE_ARGS='{"Args":["upgrade",""]}'
|
|
|
|
CC_MAP_INVOKE_ARGS='{"Args":["invoke","put","key","value"]}'
|
|
|
|
CC_MAP_QUERY_ARGS='{"Args":["get","key"]}'
|
|
|
|
|
2018-08-22 17:27:45 +08:00
|
|
|
# Chaincode marbles related
|
|
|
|
CC_MARBLES_NAME="marblesp"
|
|
|
|
CC_MARBLES_PATH="examples/chaincode/go/marbles02_private/go"
|
|
|
|
CC_MARBLES_INIT_ARGS='{"Args":["init"]}'
|
|
|
|
CC_MARBLES_UPGRADE_ARGS='{"Args":["upgrade",""]}'
|
2018-08-27 10:52:46 +08:00
|
|
|
CC_MARBLES_INVOKE_INIT_ARGS='{"Args":["initMarble","marble1","blue","10","tom","100"]}' # price is in collectionMarblePrivateDetails
|
|
|
|
CC_MARBLES_INVOKE_INIT_ARGS_2='{"Args":["initMarble","marble2","blue","10","tom","100"]}' # price is in collectionMarblePrivateDetails
|
|
|
|
CC_MARBLES_INVOKE_TRANSFER_ARGS='{"Args":["transferMarble","marble1","jerry"]}' # price is in collectionMarblePrivateDetails
|
2018-08-22 17:27:45 +08:00
|
|
|
CC_MARBLES_QUERY_READ_ARGS='{"Args":["readMarble","marble1"]}' # this requires 'collectionMarbles' collection
|
|
|
|
CC_MARBLES_QUERY_READPVTDETAILS_ARGS='{"Args":["readMarblePrivateDetails","marble1"]}' # this requires 'collectionMarblePrivateDetails' collection
|
2018-08-27 10:52:46 +08:00
|
|
|
CC_MARBLES_QUERY_READPVTDETAILS_ARGS_2='{"Args":["readMarblePrivateDetails","marble2"]}' # this requires 'collectionMarblePrivateDetails' collection
|
2018-08-22 17:27:45 +08:00
|
|
|
CC_MARBLES_COLLECTION_CONFIG="/go/src/examples/chaincode/go/marbles02_private/collections_config.json"
|
2018-08-27 10:52:46 +08:00
|
|
|
CC_MARBLES_COLLECTION_CONFIG_NEW="/go/src/examples/chaincode/go/marbles02_private/collections_config_new.json"
|
2018-08-22 17:27:45 +08:00
|
|
|
|
2018-01-30 15:54:49 +08:00
|
|
|
# unique chaincode params
|
|
|
|
CC_NAME=${CC_02_NAME}
|
|
|
|
CC_PATH=${CC_02_PATH}
|
|
|
|
CC_INIT_ARGS=${CC_02_INIT_ARGS}
|
|
|
|
CC_INIT_VERSION=1.0
|
|
|
|
CC_UPGRADE_ARGS=${CC_02_UPGRADE_ARGS}
|
|
|
|
CC_UPGRADE_VERSION=1.1
|
|
|
|
CC_INVOKE_ARGS=${CC_02_INVOKE_ARGS}
|
|
|
|
CC_QUERY_ARGS=${CC_02_QUERY_ARGS}
|
|
|
|
|
2017-12-06 22:30:57 +08:00
|
|
|
# Generate configs
|
2018-10-11 13:53:01 +08:00
|
|
|
GEN_IMG=yeasy/hyperledger-fabric:${FABRIC_IMG_TAG} # working dir is `/go/src/github.com/hyperledger/fabric`
|
2017-12-06 22:30:57 +08:00
|
|
|
GEN_CONTAINER=generator
|
|
|
|
FABRIC_CFG_PATH=/etc/hyperledger/fabric
|
|
|
|
CHANNEL_ARTIFACTS=channel-artifacts
|
|
|
|
CRYPTO_CONFIG=crypto-config
|
2019-05-02 17:30:13 +08:00
|
|
|
ORDERER0_GENESIS=orderer0.genesis
|
|
|
|
ORDERER1_GENESIS=orderer1.genesis
|
|
|
|
ORDERER2_GENESIS=orderer2.genesis
|
|
|
|
ORDERER0_GENESIS_BLOCK=${ORDERER0_GENESIS}.block
|
|
|
|
ORDERER1_GENESIS_BLOCK=${ORDERER1_GENESIS}.block
|
|
|
|
ORDERER2_GENESIS_BLOCK=${ORDERER2_GENESIS}.block
|
2018-06-19 16:59:23 +08:00
|
|
|
ORDERER_GENESIS_PROFILE=TwoOrgsOrdererGenesis
|
|
|
|
APP_CHANNEL_PROFILE=TwoOrgsChannel
|
2018-06-07 14:34:24 +08:00
|
|
|
APP_CHANNEL_TX=${APP_CHANNEL}.tx
|
2019-05-02 15:22:34 +08:00
|
|
|
APP_CHANNEL1_TX=${APP_CHANNEL1}.tx
|
|
|
|
APP_CHANNEL2_TX=${APP_CHANNEL2}.tx
|
2017-12-12 22:47:40 +08:00
|
|
|
UPDATE_ANCHOR_ORG1_TX=Org1MSPanchors.tx
|
|
|
|
UPDATE_ANCHOR_ORG2_TX=Org2MSPanchors.tx
|
2017-12-06 22:30:57 +08:00
|
|
|
|
|
|
|
# CONFIGTXLATOR
|
2018-10-11 13:53:01 +08:00
|
|
|
CTL_IMG=yeasy/hyperledger-fabric:${FABRIC_IMG_TAG}
|
2017-12-06 22:30:57 +08:00
|
|
|
CTL_CONTAINER=configtxlator
|
|
|
|
CTL_BASE_URL=http://127.0.0.1:7059
|
|
|
|
CTL_ENCODE_URL=${CTL_BASE_URL}/protolator/encode
|
|
|
|
CTL_DECODE_URL=${CTL_BASE_URL}/protolator/decode
|
|
|
|
CTL_COMPARE_URL=${CTL_BASE_URL}/configtxlator/compute/update-from-configs
|
|
|
|
|
|
|
|
PAYLOAD_PATH=".data.data[0].payload"
|
2017-12-26 13:28:02 +08:00
|
|
|
PAYLOAD_CFG_PATH=".data.data[0].payload.data.config"
|
2017-12-06 22:30:57 +08:00
|
|
|
MAX_BATCH_SIZE_PATH=".data.data[0].payload.data.config.channel_group.groups.Orderer.values.BatchSize.value.max_message_count"
|
2017-12-29 21:52:46 +08:00
|
|
|
|
|
|
|
# channel update config
|
|
|
|
ORIGINAL_CFG_JSON=original_config.json
|
|
|
|
ORIGINAL_CFG_PB=original_config.pb
|
|
|
|
UPDATED_CFG_JSON=updated_config.json
|
|
|
|
UPDATED_CFG_PB=updated_config.pb
|
|
|
|
CFG_DELTA_JSON=config_delta.json
|
|
|
|
CFG_DELTA_PB=config_delta.pb
|
|
|
|
CFG_DELTA_ENV_JSON=config_delta_env.json
|
2018-02-08 21:23:37 +08:00
|
|
|
CFG_DELTA_ENV_PB=config_delta_env.pb
|