-
Notifications
You must be signed in to change notification settings - Fork 0
/
invoke.sh
executable file
·99 lines (87 loc) · 3.63 KB
/
invoke.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
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
while getopts "v:s:" opt
do
case "$opt" in
v ) CC_VERSION="$OPTARG" ;;
esac
done
CHANNEL_NAME="demo"
CC_NAME="interairlining"
CC_PACKAGE_NAME="${CC_NAME}_v${CC_VERSION}.tar.gz"
CC_SRC_PATH="./"
CC_SRC_LANGUAGE="node"
ORDERER_HOST="orderer.example.com"
ORDERER_URL="localhost:7050"
PEER0_ORG1_URL="localhost:7051"
PEER0_ORG2_URL="localhost:9051"
FABRIC_BASE=/home/hossein/workspace/hyperledger/fabric-samples
CRYPTO_BASE=${FABRIC_BASE}/test-network
ORDERER_TLS_CA_FILE_ADDRESS=${CRYPTO_BASE}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
PEER0_ORG1_TLS_CA_FILE_ADDRESS=${CRYPTO_BASE}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
PEER0_ORG2_TLS_CA_FILE_ADDRESS=${CRYPTO_BASE}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
ORG1_ADMIN_MSP_PATH=${CRYPTO_BASE}/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp
ORG2_ADMIN_MSP_PATH=${CRYPTO_BASE}/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp
export PATH=${FABRIC_BASE}/bin:$PATH
export FABRIC_CFG_PATH=${FABRIC_BASE}/config
switchOrg1() {
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${PEER0_ORG1_TLS_CA_FILE_ADDRESS}
export CORE_PEER_MSPCONFIGPATH=${ORG1_ADMIN_MSP_PATH}
export CORE_PEER_ADDRESS=localhost:7051
}
switchOrg2() {
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org2MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${PEER0_ORG2_TLS_CA_FILE_ADDRESS}
export CORE_PEER_MSPCONFIGPATH=${ORG2_ADMIN_MSP_PATH}
export CORE_PEER_ADDRESS=localhost:9051
}
switchOrg1
# peer chaincode invoke \
# -o ${ORDERER_URL} \
# --ordererTLSHostnameOverride ${ORDERER_HOST} \
# --tls \
# --cafile ${ORDERER_TLS_CA_FILE_ADDRESS} \
# -C ${CHANNEL_NAME} \
# -n ${CC_NAME} \
# --peerAddresses ${PEER0_ORG1_URL} \
# --tlsRootCertFiles ${PEER0_ORG1_TLS_CA_FILE_ADDRESS} \
# --peerAddresses ${PEER0_ORG2_URL} \
# --tlsRootCertFiles ${PEER0_ORG2_TLS_CA_FILE_ADDRESS} \
# -c '{"function":"createBaggage","Args":["bag_001", "user_0001", "25", "100"]}'
peer chaincode invoke \
-o ${ORDERER_URL} \
--ordererTLSHostnameOverride ${ORDERER_HOST} \
--tls \
--cafile ${ORDERER_TLS_CA_FILE_ADDRESS} \
-C ${CHANNEL_NAME} \
-n ${CC_NAME} \
--peerAddresses ${PEER0_ORG1_URL} \
--tlsRootCertFiles ${PEER0_ORG1_TLS_CA_FILE_ADDRESS} \
--peerAddresses ${PEER0_ORG2_URL} \
--tlsRootCertFiles ${PEER0_ORG2_TLS_CA_FILE_ADDRESS} \
-c '{"function":"getBaggage","Args":["bag_001"]}'
# peer chaincode invoke \
# -o ${ORDERER_URL} \
# --ordererTLSHostnameOverride ${ORDERER_HOST} \
# --tls \
# --cafile ${ORDERER_TLS_CA_FILE_ADDRESS} \
# -C ${CHANNEL_NAME} \
# -n ${CC_NAME} \
# --peerAddresses ${PEER0_ORG1_URL} \
# --tlsRootCertFiles ${PEER0_ORG1_TLS_CA_FILE_ADDRESS} \
# --peerAddresses ${PEER0_ORG2_URL} \
# --tlsRootCertFiles ${PEER0_ORG2_TLS_CA_FILE_ADDRESS} \
# -c '{"function":"updateBaggageOwner","Args":["bag_001", "user_0002"]}'
# peer chaincode invoke \
# -o ${ORDERER_URL} \
# --ordererTLSHostnameOverride ${ORDERER_HOST} \
# --tls \
# --cafile ${ORDERER_TLS_CA_FILE_ADDRESS} \
# -C ${CHANNEL_NAME} \
# -n ${CC_NAME} \
# --peerAddresses ${PEER0_ORG1_URL} \
# --tlsRootCertFiles ${PEER0_ORG1_TLS_CA_FILE_ADDRESS} \
# --peerAddresses ${PEER0_ORG2_URL} \
# --tlsRootCertFiles ${PEER0_ORG2_TLS_CA_FILE_ADDRESS} \
# -c '{"function":"getBaggage","Args":["bag_001"]}'