-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerateChannelArtifacts.sh
executable file
·52 lines (48 loc) · 1.78 KB
/
generateChannelArtifacts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function generateChannelArtifacts() {
which configtxgen
if [ "$?" -ne 0 ]; then
echo "configtxgen tool not found. exiting"
exit 1
fi
echo "######### Generating Orderer Genesis block ##############"
# Note: For some unknown reason (at least for now) the block file can't be
# named orderer.genesis.block or the orderer will fail to launch!
set -x
FABRIC_CFG_PATH=$PWD/src/artifacts/channel configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./src/artifacts/channel/genesis.block
res=$?
set +x
if [ $res -ne 0 ]; then
echo "Failed to generate orderer genesis block..."
exit 1
fi
echo "### Generating channel configuration transaction 'channel.tx' ###"
set -x
FABRIC_CFG_PATH=$PWD/src/artifacts/channel configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./src/artifacts/channel/mychannel.tx -channelID mychannel
res=$?
set +x
if [ $res -ne 0 ]; then
echo "Failed to generate channel configuration transaction..."
exit 1
fi
echo "####### Generating anchor peer update for Org1MSP ##########"
set -x
FABRIC_CFG_PATH=$PWD/src/artifacts/channel configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./src/artifacts/channel/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
res=$?
set +x
if [ $res -ne 0 ]; then
echo "Failed to generate anchor peer update for Org1MSP..."
exit 1
fi
echo "####### Generating anchor peer update for Org2MSP ##########"
set -x
FABRIC_CFG_PATH=$PWD/src/artifacts/channel configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate \
./src/artifacts/channel/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
res=$?
set +x
if [ $res -ne 0 ]; then
echo "Failed to generate anchor peer update for Org2MSP..."
exit 1
fi
echo
}
generateChannelArtifacts