-
Notifications
You must be signed in to change notification settings - Fork 1
/
createChannel.sh
45 lines (30 loc) · 1.35 KB
/
createChannel.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
. ./envVar.sh
if [ ! -d "channel-artifacts" ]; then
mkdir ./channel-artifacts
fi
createChannel(){
rm -rf ./channel-artifacts/*
setGlobalsForPeer0Org1
peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.example.com -f ./artifacts/channel/${CHANNEL_NAME}.tx --outputBlock ./channel-artifacts/${CHANNEL_NAME}.block --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
}
joinChannel(){
setGlobalsForPeer0Org1
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org1
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org2
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org2
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
}
updateAnchorPeers(){
setGlobalsForPeer0Org1
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org2
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
}
setup_channel(){
createChannel
joinChannel
updateAnchorPeers
}