-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreateChannel.sh
More file actions
executable file
·94 lines (69 loc) · 3.71 KB
/
createChannel.sh
File metadata and controls
executable file
·94 lines (69 loc) · 3.71 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
ORG1=""
ORG2=""
DOMAIN=""
ORG1_LOWER=""
ORG2_LOWER=""
export CHANNEL_NAME=""
export CORE_PEER_TLS_ENABLED=true
export ORDERER_CA=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/${DOMAIN}/orderers/orderer.${DOMAIN}/msp/tlscacerts/tlsca.${DOMAIN}-cert.pem
export PEER0_ORG1_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG1_LOWER}.${DOMAIN}/peers/peer0.${ORG1_LOWER}.${DOMAIN}/tls/ca.crt
export PEER0_ORG2_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG2_LOWER}.${DOMAIN}/peers/peer0.${ORG2_LOWER}.${DOMAIN}/tls/ca.crt
export FABRIC_CFG_PATH=${PWD}/artifacts/channel/config/
setGlobalsForOrderer(){
export CORE_PEER_LOCALMSPID=""
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/${DOMAIN}/orderers/orderer.${DOMAIN}/msp/tlscacerts/tlsca.${DOMAIN}-cert.pem
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/${DOMAIN}/users/Admin@${DOMAIN}/msp
}
setGlobalsForPeer0Coop(){
export CORE_PEER_LOCALMSPID="${ORG1}MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG1_LOWER}.${DOMAIN}/users/Admin@${ORG1_LOWER}.${DOMAIN}/msp
export CORE_PEER_ADDRESS=localhost:7051
}
# setGlobalsForPeer1Coop(){
# export CORE_PEER_LOCALMSPID="CoopMSP"
# export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
# export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG1_LOWER}.${DOMAIN}/users/Admin@${ORG1_LOWER}.${DOMAIN}/msp
# export CORE_PEER_ADDRESS=localhost:8051
# }
setGlobalsForPeer0Analytics(){
export CORE_PEER_LOCALMSPID="${ORG2}MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG2_LOWER}.${DOMAIN}/users/Admin@${ORG2_LOWER}.${DOMAIN}/msp
export CORE_PEER_ADDRESS=localhost:9051
}
# setGlobalsForPeer1Analytics(){
# export CORE_PEER_LOCALMSPID="AnalyticsMSP"
# export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA
# export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/${ORG2_LOWER}.${DOMAIN}/users/Admin@${ORG2_LOWER}.${DOMAIN}/msp
# export CORE_PEER_ADDRESS=localhost:10051
# }
createChannel(){
rm -rf ./channel-artifacts/*
setGlobalsForPeer0Coop
peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.${DOMAIN} -f ./artifacts/channel/${CHANNEL_NAME}.tx --outputBlock ./channel-artifacts/${CHANNEL_NAME}.block --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
}
# removeOldCrypto(){
# rm -rf ./api-1.4/crypto/*
# rm -rf ./api-1.4/fabric-client-kv-org1/*
# }
joinChannel(){
setGlobalsForPeer0Coop
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
# setGlobalsForPeer1Coop
# peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Analytics
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
# setGlobalsForPeer1Analytics
# peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
}
updateAnchorPeers(){
setGlobalsForPeer0Coop
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.${DOMAIN} -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Analytics
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.${DOMAIN} -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
}
# removeOldCrypto
createChannel
joinChannel
updateAnchorPeers