-
Notifications
You must be signed in to change notification settings - Fork 4
/
CLI Commands
97 lines (56 loc) · 8.51 KB
/
CLI Commands
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
cd ~/Desktop/pharma-network/network/
configtxgen -profile OrdererGenesis -channelID upgrad-sys-channel -outputBlock ./channel-artifacts/genesis.block
configtxgen -profile PharmaChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID pharmachannel
configtxgen -profile PharmaChannel -outputAnchorPeersUpdate ./channel-artifacts/manufacturerMSPanchors.tx -channelID pharmachannel -asOrg manufacturerMSP
configtxgen -profile PharmaChannel -outputAnchorPeersUpdate ./channel-artifacts/distributorMSPanchors.tx -channelID pharmachannel -asOrg distributorMSP
configtxgen -profile PharmaChannel -outputAnchorPeersUpdate ./channel-artifacts/retailerMSPanchors.tx -channelID pharmachannel -asOrg retailerMSP
configtxgen -profile PharmaChannel -outputAnchorPeersUpdate ./channel-artifacts/consumerMSPanchors.tx -channelID pharmachannel -asOrg consumerMSP
configtxgen -profile PharmaChannel -outputAnchorPeersUpdate ./channel-artifacts/transporterMSPanchors.tx -channelID pharmachannel -asOrg transporterMSP
peer channel create -o orderer.pharma-network.com:7050 -c pharmachannel -f ./channel-artifacts/channel.tx
peer channel join -b pharmachannel.block
docker rm $(docker ps -a -q)
docker rmi $(docker images |grep 'dev-peer')
docker exec -it chaincode /bin/bash
npm run start-dev
docker exec -it cli /bin/bash
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:registerCompany","MAN001","Sun Pharma","Chennai","Manufacturer"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:registerCompany","DIST001","VG pharma","Vizag","Distributor"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:registerCompany","RET002","upgrad","Mumbai","Retailer"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:registerCompany","TRA001","FedEx","Delhi","Transporter"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:registerCompany","TRA002","Blue Dart","Bangalore","Transporter"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:addDrug","Paracetamol","001","01/01/2020","01/06/2025","MAN001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:addDrug","Paracetamol","002","01/01/2020","01/06/2025","MAN001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:addDrug","Paracetamol","003","01/01/2020","01/06/2025","MAN001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:addDrug","Paracetamol","004","01/01/2020","01/06/2025","MAN001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:viewDrugCurrentState","Paracetamol","001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:viewHistory","Paracetamol","001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.manufacturer:createShipment","DIST001","Paracetamol","[\"org.pharma-network.pharmanet.drugParacetamol001\"]","TRA001"]}'
docker exec -it cli /bin/bash
CORE_PEER_LOCALMSPID="distributorMSP"
CORE_PEER_ADDRESS=peer0.distributor.pharma-network.com:9051
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/distributor.pharma-network.com/users/Admin@distributor.pharma-network.com/msp
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createPO","MAN001","DIST001","TEST","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createPO","DIST0011","MAN001","TEST","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createPO","DIST001","MAN001","TEST","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createPO","DIST001","MAN001","Brufin","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createPO","DIST001","MAN001","Paracetamol","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createShipment","RET002","Paracetamol","[\"org.pharma-network.pharmanet.drugParacetamol001\"]","TRA002"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createShipment","XYZ001","Paracetamol","[\"org.pharma-network.pharmanet.drugParacetamol001\"]","TRA002"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.distributor:createShipment","RET002","Paracetamol","[\"org.pharma-network.pharmanet.drugParacetamol001\"]","XYZ001"]}'
docker exec -it cli /bin/bash
CORE_PEER_LOCALMSPID="retailerMSP"
CORE_PEER_ADDRESS=peer0.retailer.pharma-network.com:11051
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/retailer.pharma-network.com/users/Admin@retailer.pharma-network.com/msp
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:createPO","CRN-001","CRN-003","TEST","1"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:createPO","RET002","DIST001","Paracetamol","2"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.retailer:retailDrug","Paracetamol","001","RET002","9090-1212-3434"]}'
docker exec -it cli /bin/bash
CORE_PEER_LOCALMSPID="transporterMSP"
CORE_PEER_ADDRESS=peer0.transporter.pharma-network.com:15051
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/transporter.pharma-network.com/users/Admin@transporter.pharma-network.com/msp
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.transporter:updateShipment","DIST001","Paracetamol","TRA001"]}'
peer chaincode invoke -o orderer.pharma-network.com:7050 -C pharmachannel -n pharmanet -c '{"Args":["org.pharma-network.pharmanet.transporter:updateShipment","RET002","Paracetamol","TRA002"]}'
https://hyperledger.github.io/fabric-chaincode-node/master/api/fabric-shim.ChaincodeStub.html#createCompositeKey__anchor
"{\"shipmentID\":\"\\u0000org.pharma-network.pharmanet.shipment\\u0000DIST001\\u0000Paracetamol\\u0000\",\"creator\":\"\\u0000org.pharma-network.pharmanet.company\\u0000DIST001\\u0000VG pharma\\u0000\",\"assets\":[\"\\u0000org.pharma-network.pharmanet.drug\\u0000Paracetamol\\u0000001\\u0000\"],\"transporterCRN\":\"TRA001\",\"status\":\"DELIVERED\"}"
"{\"shipmentID\":\"\\u0000org.pharma-network.pharmanet.shipment\\u0000RET002\\u0000Paracetamol\\u0000\",\"creator\":\"\\u0000org.pharma-network.pharmanet.company\\u0000RET002\\u0000upgrad\\u0000\",\"assets\":[\"\\u0000org.pharma-network.pharmanet.drug\\u0000Paracetamol\\u0000001\\u0000\"],\"transporterCRN\":\"TRA002\",\"status\":\"DELIVERED\"}"
"{\"productID\":\"\\u0000org.pharma-network.pharmanet.drug\\u0000Paracetamol\\u0000001\\u0000\",\"name\":\"Paracetamol\",\"manufacturer\":\"\\u0000org.pharma-network.pharmanet.company\\u0000MAN001\\u0000Sun Pharma\\u0000\",\"manufacturingDate\":\"01/06/2020\",\"expiryDate\":\"01/06/2025\",\"owner\":\"9090-1212-3434\",\"shipment\":[\"\\u0000org.pharma-network.pharmanet.shipment\\u0000DIST001\\u0000Paracetamol\\u0000\",\"\\u0000org.pharma-network.pharmanet.shipment\\u0000RET002\\u0000Paracetamol\\u0000\"]}"