generateCfgTrx.sh 968 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. CHANNEL_NAME=$1
  3. if [ -z "$1" ]; then
  4. echo "Setting channel to default name 'mychannel'"
  5. CHANNEL_NAME="mychannel"
  6. fi
  7. echo "Channel name - "$CHANNEL_NAME
  8. echo
  9. #Backup the original configtx.yaml
  10. cp ../../common/configtx/tool/configtx.yaml ../../common/configtx/tool/configtx.yaml.orig
  11. cp configtx.yaml ../../common/configtx/tool/configtx.yaml
  12. cd $PWD/../../
  13. echo "Building configtxgen"
  14. make configtxgen
  15. echo "Generating genesis block"
  16. ./build/bin/configtxgen -profile TwoOrgs -outputBlock twoorgs.orderer.block
  17. mv twoorgs.orderer.block examples/midea/channel/twoorgs.orderer.block
  18. echo "Generating channel configuration transaction"
  19. ./build/bin/configtxgen -profile TwoOrgs -outputCreateChannelTx mychannel.tx -channelID $CHANNEL_NAME
  20. mv mychannel.tx examples/midea/channel/mychannel.tx
  21. #reset configtx.yaml file to its original
  22. cp common/configtx/tool/configtx.yaml.orig common/configtx/tool/configtx.yaml
  23. rm common/configtx/tool/configtx.yaml.orig