2018-10-11 13:53:01 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Use ${FABRIC_CFG_PATH}/configtx.yaml to generate following materials,
|
|
|
|
# and put under /tmp/$CHANNEL_ARTIFACTS:
|
|
|
|
# system channel genesis block
|
|
|
|
# new app channel tx
|
|
|
|
# update anchor peer tx
|
|
|
|
|
|
|
|
# Define those global variables
|
|
|
|
if [ -f ./variables.sh ]; then
|
|
|
|
source ./variables.sh
|
2018-10-12 11:33:24 +08:00
|
|
|
elif [ -f /scripts/variables.sh ]; then
|
|
|
|
source /scripts/variables.sh
|
2018-10-11 13:53:01 +08:00
|
|
|
else
|
|
|
|
echo "Cannot find the variables.sh files, pls check"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-12 11:33:24 +08:00
|
|
|
cd /tmp/${CHANNEL_ARTIFACTS} # all generated materials will be put under /tmp/$CHANNEL_ARTIFACTS
|
2018-10-11 13:53:01 +08:00
|
|
|
|
|
|
|
echo "Generate genesis block for system channel using configtx.yaml"
|
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-channelID ${SYS_CHANNEL} \
|
|
|
|
-profile ${ORDERER_GENESIS_PROFILE} \
|
|
|
|
-outputBlock ${ORDERER_GENESIS}
|
|
|
|
|
|
|
|
echo "Create the new app channel tx using configtx.yaml"
|
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-profile ${APP_CHANNEL_PROFILE} \
|
|
|
|
-channelID ${APP_CHANNEL} \
|
|
|
|
-outputCreateChannelTx ${APP_CHANNEL_TX}
|
|
|
|
configtxgen \
|
|
|
|
-inspectChannelCreateTx ${APP_CHANNEL_TX} > ${APP_CHANNEL_TX}.json
|
|
|
|
|
|
|
|
echo "Create the anchor peer configuration tx for org1 and org2"
|
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-profile ${APP_CHANNEL_PROFILE} \
|
|
|
|
-channelID ${APP_CHANNEL} \
|
|
|
|
-asOrg ${ORG1MSP} \
|
|
|
|
-outputAnchorPeersUpdate ${UPDATE_ANCHOR_ORG1_TX}
|
2018-10-12 11:33:24 +08:00
|
|
|
|
2018-10-11 13:53:01 +08:00
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-profile ${APP_CHANNEL_PROFILE} \
|
|
|
|
-channelID ${APP_CHANNEL} \
|
|
|
|
-asOrg ${ORG2MSP} \
|
|
|
|
-outputAnchorPeersUpdate ${UPDATE_ANCHOR_ORG2_TX}
|
|
|
|
|
|
|
|
echo "Output the json for org1, org2 and org3"
|
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-printOrg ${ORG1MSP} >${ORG1MSP}.json
|
2018-10-12 11:33:24 +08:00
|
|
|
|
2018-10-11 13:53:01 +08:00
|
|
|
configtxgen \
|
2018-10-12 11:33:24 +08:00
|
|
|
-configPath /tmp \
|
2018-10-11 13:53:01 +08:00
|
|
|
-printOrg ${ORG2MSP} >${ORG2MSP}.json
|
2018-10-12 11:33:24 +08:00
|
|
|
|
2018-10-11 13:53:01 +08:00
|
|
|
configtxgen \
|
|
|
|
-configPath /tmp/org3/ \
|
|
|
|
-printOrg ${ORG3MSP} >${ORG3MSP}.json
|