initialize_peer0.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Importing useful functions for cc testing
  3. if [ -f ./func.sh ]; then
  4. source ./func.sh
  5. elif [ -f scripts/func.sh ]; then
  6. source scripts/func.sh
  7. fi
  8. echo_b " ========== Network initialization start ========== "
  9. ## Create channel
  10. echo_b "Creating channel ${APP_CHANNEL} with ${APP_CHANNEL_TX}..."
  11. channelCreate ${APP_CHANNEL} ${APP_CHANNEL_TX}
  12. sleep 1
  13. ## Join all the peers to the channel
  14. echo_b "Having peer0 join the channel..."
  15. channelJoin ${APP_CHANNEL} 0
  16. ## Set the anchor peers for each org in the channel
  17. echo_b "Updating anchor peers for peer0/org1... no use for only single channel"
  18. updateAnchorPeers ${APP_CHANNEL} 0
  19. ## Install chaincode on all peers
  20. echo_b "Installing chaincode on peer0..."
  21. chaincodeInstall 0 ${CC_INIT_ARGS}
  22. # Instantiate chaincode on all peers
  23. # Instantiate can only be executed once on any node
  24. echo_b "Instantiating chaincode on the channel..."
  25. chaincodeInstantiate ${APP_CHANNEL} 0
  26. echo_g "=============== All GOOD, network initialization done =============== "
  27. echo
  28. exit 0