docker-compose-files/hyperledger_fabric/v1.0.0/scripts/initialize_all.sh

60 lines
1.3 KiB
Bash
Raw Normal View History

2017-06-09 19:42:58 +08:00
#!/bin/bash
2017-08-25 13:02:44 +08:00
# Importing useful functions for cc testing
if [ -f ./func.sh ]; then
source ./func.sh
elif [ -f scripts/func.sh ]; then
source scripts/func.sh
2017-07-10 17:24:19 +08:00
fi
2017-06-09 19:42:58 +08:00
echo
echo " ============================================== "
echo " ==========initialize businesschannel========== "
echo " ============================================== "
echo
2017-06-14 13:30:12 +08:00
echo_b "Channel name : "$CHANNEL_NAME
2017-06-09 19:42:58 +08:00
## Create channel
2017-06-14 13:30:12 +08:00
echo_b "Creating channel..."
2017-06-09 19:42:58 +08:00
createChannel
## Join all the peers to the channel
2017-06-14 13:30:12 +08:00
echo_b "Having all peers join the channel..."
2017-06-09 19:42:58 +08:00
joinChannel
2017-08-31 15:59:37 +08:00
2017-06-09 19:42:58 +08:00
## Set the anchor peers for each org in the channel
2017-06-14 13:30:12 +08:00
echo_b "Updating anchor peers for org1..."
2017-06-09 19:42:58 +08:00
updateAnchorPeers 0
2017-06-14 13:30:12 +08:00
echo_b "Updating anchor peers for org2..."
2017-06-09 19:42:58 +08:00
updateAnchorPeers 2
2017-08-22 16:34:37 +08:00
## Install chaincode on all peers
echo_b "Installing chaincode on all 4 peers..."
2017-06-09 19:42:58 +08:00
installChaincode 0
installChaincode 1
installChaincode 2
installChaincode 3
2017-08-22 16:34:37 +08:00
# Instantiate chaincode on all peers
2017-06-09 19:42:58 +08:00
# Instantiate can only be executed once on any node
2017-09-01 20:18:46 +08:00
echo_b "Instantiating chaincode on all 2 channels (once for each channel)..."
2017-06-29 15:52:35 +08:00
instantiateChaincode 0
2017-08-22 16:34:37 +08:00
instantiateChaincode 2
2017-06-09 19:42:58 +08:00
echo
2017-06-14 13:30:12 +08:00
echo_g "===================== All GOOD, initialization completed ===================== "
2017-06-09 19:42:58 +08:00
echo
echo
echo " _____ _ _ ____ "
echo "| ____| | \ | | | _ \ "
echo "| _| | \| | | | | |"
echo "| |___ | |\ | | |_| |"
echo "|_____| |_| \_| |____/ "
echo
exit 0