generateCfgTrx.sh 1.0 KB

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 MideaOrgs -outputBlock orderer.block
  17. mv orderer.block examples/midea/crypto-config/ordererOrganizations/ordererOrg1/orderers/orderer.block
  18. echo "Generating channel configuration transaction"
  19. ./build/bin/configtxgen -profile MideaOrgs -outputCreateChannelTx channel.tx -channelID $CHANNEL_NAME
  20. mv channel.tx examples/midea/crypto-config/ordererOrganizations/ordererOrg1/orderers/channel.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