docker-compose-files/hyperledger_fabric/v1.0.2/scripts/initialize_peer0.sh

62 lines
1.2 KiB
Bash
Raw Normal View History

2017-09-01 20:09:18 +08:00
#!/bin/bash
# Importing useful functions for cc testing
if [ -f ./func.sh ]; then
source ./func.sh
elif [ -f scripts/func.sh ]; then
source scripts/func.sh
fi
echo
echo " ============================================== "
echo " ==========initialize businesschannel========== "
echo " ============================================== "
echo
echo_b "Channel name : "$CHANNEL_NAME
## Create channel
echo_b "Creating channel..."
2017-09-22 15:16:19 +08:00
channelCreate
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
## Join all the peers to the channel
2017-09-11 10:33:29 +08:00
echo_b "Having peer0 join the channel..."
2017-09-22 15:16:19 +08:00
channelJoin 0
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
## Set the anchor peers for each org in the channel
echo_b "Updating anchor peers for peer0/org1..."
updateAnchorPeers 0
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
## Install chaincode on all peers
echo_b "Installing chaincode on peer0..."
2017-09-22 15:16:19 +08:00
chaincodeInstall 0 1.0
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
# Instantiate chaincode on all peers
# Instantiate can only be executed once on any node
echo_b "Instantiating chaincode on the channel..."
2017-09-22 15:16:19 +08:00
chaincodeInstantiate 0
2017-09-01 20:09:18 +08:00
2017-09-14 15:26:06 +08:00
sleep 1
2017-09-01 20:09:18 +08:00
echo
echo_g "===================== All GOOD, initialization completed ===================== "
echo
echo
echo " _____ _ _ ____ "
echo "| ____| | \ | | | _ \ "
echo "| _| | \| | | | | |"
echo "| |___ | |\ | | |_| |"
echo "|_____| |_| \_| |____/ "
echo
exit 0