7. 멀티호스트 환경 운영 - 체인코드
페이지 정보
작성자 관리자 댓글 0건 조회 2,618회 작성일 19-08-28 09:45본문
root@client:~/testnet# vi installCCpeer0.sh
root@client:~/testnet# chmod 777 installCCpeer0.sh
root@client:~/testnet# ./installCCpeer0.sh
2019-08-28 11:40:50.435 KST [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-28 11:40:50.435 KST [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-28 11:40:56.600 KST [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
root@client:~/testnet#
Peer0노드에서 확인한다.
root@peer0:~# tree /var/hyperledger/
/var/hyperledger/
└── production
├── chaincodes
│ └── testnetCC.1.0
├── ledgersData
│ ├── bookkeeper
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ ├── chains
│ │ ├── chains
│ │ │ └── ch1
│ │ │ └── blockfile_000000
│ │ └── index
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ ├── configHistory
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ ├── historyLeveldb
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ ├── ledgerProvider
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ ├── pvtdataStore
│ │ ├── 000001.log
│ │ ├── CURRENT
│ │ ├── LOCK
│ │ ├── LOG
│ │ └── MANIFEST-000000
│ └── stateLeveldb
│ ├── 000001.log
│ ├── CURRENT
│ ├── LOCK
│ ├── LOG
│ └── MANIFEST-000000
└── transientStore
├── 000001.log
├── CURRENT
├── LOCK
├── LOG
└── MANIFEST-000000
14 directories, 42 files
root@peer0:~#
root@client:~/testnet# vi installedCClist.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode list -C ch1 --installed
root@client:~/testnet# chmod 777 installedCClist.sh
root@client:~/testnet# ./installedCClist.sh
Get installed chaincodes on peer:
Name: testnetCC, Version: 1.0, Path: github.com/hyperledger/fabric/examples/chaincode/go/example02/cmd, Id: 3593e34c4e4cdb032d111b9d30563140ccd9fb2235b3e511fcdd52ca0e3a2560
root@client:~/testnet#
root@client:~/testnet# vi instantiateCC.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode instantiate -o orderer0:7050 -C ch1 -n testnetCC -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
root@client:~/testnet# chmod 777 instantiateCC.sh
root@client:~/testnet# ./instantiateCC.sh
2019-08-28 11:54:02.792 KST [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-28 11:54:02.792 KST [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
root@client:~/testnet#
root@client:~/testnet# vi instantiatedCClist.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode list -C ch1 --instantiated
root@client:~/testnet# chmod 777 instantiatedCClist.sh
root@client:~/testnet# ./instantiatedCClist.sh
Get instantiated chaincodes on channel ch1:
Name: testnetCC, Version: 1.0, Path: github.com/hyperledger/fabric/examples/chaincode/go/example02/cmd, Escc: escc, Vscc: vscc
root@client:~/testnet#
root@client:~/testnet# vi query.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode query -C ch1 -n testnetCC -c '{"Args":["query","b"]}'
root@client:~/testnet# chmod 777 query.sh
root@client:~/testnet# ./query.sh
200
root@client:~/testnet#
root@client:~/testnet# vi invoke.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode invoke -o orderer0:7050 -C ch1 -n testnetCC -c '{"Args":["invoke","a","b","20"]}'
root@client:~/testnet# chmod 777 invoke.sh
root@client:~/testnet# ./invoke.sh
2019-08-28 12:07:35.565 KST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200
root@client:~/testnet# vi query.sh
export CORE_PEER_LOCALMSPID="Org0MSP"
export CORE_PEER_MSPCONFIGPATH=/root/testnet/crypto-config/peerOrganizations/org0/users/Admin@org0/msp
export CORE_PEER_ADDRESS=peer0:7051
peer chaincode query -C ch1 -n testnetCC -c '{"Args":["query","a"]}'
root@client:~/testnet# ./query.sh
80
root@client:~/testnet#
댓글목록
등록된 댓글이 없습니다.