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

39 lines
1.0 KiB
Bash
Raw Normal View History

2017-11-02 10:19:05 +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
2017-11-06 12:18:37 +08:00
echo_b " ========== Network initialization start ========== "
2017-11-02 10:19:05 +08:00
## Create channel
2017-12-19 14:40:39 +08:00
echo_b "Creating channel ${APP_CHANNEL} with ${APP_CHANNEL_TX}..."
channelCreate ${APP_CHANNEL} ${APP_CHANNEL_TX}
2017-11-02 10:19:05 +08:00
sleep 1
## Join all the peers to the channel
echo_b "Having peer0 join the channel..."
2017-12-06 16:24:33 +08:00
channelJoin ${APP_CHANNEL} 0
2017-11-02 10:19:05 +08:00
## Set the anchor peers for each org in the channel
echo_b "Updating anchor peers for peer0/org1... no use for only single channel"
2017-12-29 22:29:56 +08:00
channelUpdate ${APP_CHANNEL} 1 0 Org1MSPanchors.tx
2017-11-02 10:19:05 +08:00
## Install chaincode on all peers
echo_b "Installing chaincode on peer0..."
chaincodeInstall 0 ${CC_02_INIT_ARGS}
2017-11-02 10:19:05 +08:00
# Instantiate chaincode on all peers
# Instantiate can only be executed once on any node
echo_b "Instantiating chaincode on the channel..."
2017-12-06 16:24:33 +08:00
chaincodeInstantiate ${APP_CHANNEL} 0
2017-11-02 10:19:05 +08:00
2017-11-06 12:18:37 +08:00
echo_g "=============== All GOOD, network initialization done =============== "
2017-11-02 10:19:05 +08:00
echo
exit 0