-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateChannel.sh
More file actions
247 lines (183 loc) · 11.4 KB
/
createChannel.sh
File metadata and controls
247 lines (183 loc) · 11.4 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
export CORE_PEER_TLS_ENABLED=true
export ORDERER_CA=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/wevioo.com/orderers/orderer.wevioo.com/msp/tlscacerts/tlsca.wevioo.com-cert.pem
export PEER0_ORG1_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Olivemill.wevioo.com/peers/peer0.Olivemill.wevioo.com/tls/ca.crt
export PEER0_ORG2_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveStorage.wevioo.com/peers/peer0.OliveStorage.wevioo.com/tls/ca.crt
export PEER0_ORG3_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveTestLaboratory.wevioo.com/peers/peer0.OliveTestLaboratory.wevioo.com/tls/ca.crt
export PEER0_ORG4_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/PackagingandLabelling.wevioo.com/peers/peer0.PackagingandLabelling.wevioo.com/tls/ca.crt
export PEER0_ORG5_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Customs.wevioo.com/peers/peer0.Customs.wevioo.com/tls/ca.crt
export PEER0_ORG6_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Ministryofcommerce.wevioo.com/peers/peer0.Ministryofcommerce.wevioo.com/tls/ca.crt
export PEER0_ORG7_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/MinistryofAgriculture.wevioo.com/peers/peer0.MinistryofAgriculture.wevioo.com/tls/ca.crt
export PEER0_ORG8_CA=${PWD}/artifacts/channel/crypto-config/peerOrganizations/InstitutionofCertificationBio.wevioo.com/peers/peer0.InstitutionofCertificationBio.wevioo.com/tls/ca.crt
export FABRIC_CFG_PATH=${PWD}/artifacts/channel/config/
export CHANNEL_NAME=mychannel
# setGlobalsForOrderer(){
# export CORE_PEER_LOCALMSPID="OrdererMSP"
# export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/wevioo.com/orderers/orderer.wevioo.com/msp/tlscacerts/tlsca.wevioo.com-cert.pem
# export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/ordererOrganizations/wevioo.com/users/Admin@wevioo.com/msp
# }
setGlobalsForPeer0Org1(){
export CORE_PEER_LOCALMSPID="OlivemillMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Olivemill.wevioo.com/users/Admin@Olivemill.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:7051
}
setGlobalsForPeer1Org1(){
export CORE_PEER_LOCALMSPID="OlivemillMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Olivemill.wevioo.com/users/Admin@Olivemill.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:8051
}
setGlobalsForPeer0Org2(){
export CORE_PEER_LOCALMSPID="OliveStorageMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveStorage.wevioo.com/users/Admin@OliveStorage.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:9051
}
setGlobalsForPeer1Org2(){
export CORE_PEER_LOCALMSPID="OliveStorageMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveStorage.wevioo.com/users/Admin@OliveStorage.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:10051
}
setGlobalsForPeer0Org3(){
export CORE_PEER_LOCALMSPID="OliveTestLaboratoryMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveTestLaboratory.wevioo.com/users/Admin@OliveTestLaboratory.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:11051
}
setGlobalsForPeer1Org3(){
export CORE_PEER_LOCALMSPID="OliveTestLaboratoryMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/OliveTestLaboratory.wevioo.com/users/Admin@OliveTestLaboratory.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:12051
}
setGlobalsForPeer0Org4(){
export CORE_PEER_LOCALMSPID="PackagingandLabellingMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG4_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/PackagingandLabelling.wevioo.com/users/Admin@PackagingandLabelling.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:13051
}
setGlobalsForPeer1Org4(){
export CORE_PEER_LOCALMSPID="PackagingandLabellingMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG4_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/PackagingandLabelling.wevioo.com/users/Admin@PackagingandLabelling.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:14051
}
setGlobalsForPeer0Org5(){
export CORE_PEER_LOCALMSPID="CustomsMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG5_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Customs.wevioo.com/users/Admin@Customs.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:15051
}
setGlobalsForPeer1Org5(){
export CORE_PEER_LOCALMSPID="CustomsMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG5_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Customs.wevioo.com/users/Admin@Customs.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:16051
}
setGlobalsForPeer0Org6(){
export CORE_PEER_LOCALMSPID="MinistryofcommerceMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG6_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Ministryofcommerce.wevioo.com/users/Admin@Ministryofcommerce.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:17051
}
setGlobalsForPeer1Org6(){
export CORE_PEER_LOCALMSPID="MinistryofcommerceMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG6_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/Ministryofcommerce.wevioo.com/users/Admin@Ministryofcommerce.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:18051
}
setGlobalsForPeer0Org7(){
export CORE_PEER_LOCALMSPID="MinistryofAgricultureMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG7_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/MinistryofAgriculture.wevioo.com/users/Admin@MinistryofAgriculture.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:19051
}
setGlobalsForPeer1Org7(){
export CORE_PEER_LOCALMSPID="MinistryofAgricultureMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG7_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/MinistryofAgriculture.wevioo.com/users/Admin@MinistryofAgriculture.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:20051
}
setGlobalsForPeer0Org8(){
export CORE_PEER_LOCALMSPID="InstitutionofCertificationBioMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG8_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/InstitutionofCertificationBio.wevioo.com/users/Admin@InstitutionofCertificationBio.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:21051
}
setGlobalsForPeer1Org8(){
export CORE_PEER_LOCALMSPID="InstitutionofCertificationBioMSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG8_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/artifacts/channel/crypto-config/peerOrganizations/InstitutionofCertificationBio.wevioo.com/users/Admin@InstitutionofCertificationBio.wevioo.com/msp
export CORE_PEER_ADDRESS=localhost:22051
}
createChannel(){
rm -rf ./channel-artifacts/*
setGlobalsForPeer0Org1
peer channel create -o localhost:7050 -c $CHANNEL_NAME \
--ordererTLSHostnameOverride orderer.wevioo.com \
-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/*
rm -rf ./api-2.0/org1-wallet/*
rm -rf ./api-2.0/org2-wallet/*
}
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
setGlobalsForPeer0Org3
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org3
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org4
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org4
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org5
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org5
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org6
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org6
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org7
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org7
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer0Org8
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
setGlobalsForPeer1Org8
peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block
}
updateAnchorPeers(){
setGlobalsForPeer0Org1
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.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.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org3
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org4
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org5
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org6
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org7
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
setGlobalsForPeer0Org8
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.wevioo.com -c $CHANNEL_NAME -f ./artifacts/channel/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
}
removeOldCrypto
createChannel
#joinChannel
#updateAnchorPeers