Tools, FAQ, Tutorials:
Instantiate Chaincode on BYFN Channel
How to Instantiate Chaincode on BYFN Channel?
✍: FYIcenter.com
You can follow this tutorial to Instantiate Chaincode on BYFN Channel manually.
1. Verify the installed chaincode:
$ docker exec -it cli bash bash-4.4# echo $CORE_PEER_ADDRESS peer0.org2.example.com:7051 bash-4.4# peer chaincode list --installed Get installed chaincodes on peer: Name: mycc, Version: 1.0, Path: /opt/gopath/src/github.com/chaincode\ /chaincode_example02/node/, Id: ade2b27...
2. Instantiate the chaincode on the "mychannel" channel:
bash-4.4# peer chaincode instantiate -o orderer.example.com:7050 --tls \
--cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto\
/ordererOrganizations/example.com/orderers/orderer.example.com/msp\
/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -v 1.0 \
-c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
[chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
[chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not
successful, error code 500, msg error starting container: error starting
container: Failed to generate platform-specific docker build: Failed to
pull hyperledger/fabric-nodeenv:latest: API error (404): manifest for
hyperledger/fabric-nodeenv:latest not found
As you can see, the "peer chaincode instantiate" command failed. The error is related the anchor peer in each peer organization. You need to redo the step of updating peer0 as the anchor peer in each organization using the "peer channel update" command.
3. Try again:
bash-4.4# peer chaincode instantiate -o orderer.example.com:7050 --tls \
--cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto\
/ordererOrganizations/example.com/orderers/orderer.example.com/msp\
/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -v 1.0 \
-c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
[chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
[chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not
successful, error code 500, msg cannot get package for chaincode (mycc:1.0)
The command failed again. The error is related the missing chaincode on the anchor peer. You need to redo the step of installing chaincode on the anchor peer in each organization using the "peer chaincode install" command.
4. Try again:
bash-4.4# peer chaincode instantiate -o orderer.example.com:7050 --tls \
--cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto\
/ordererOrganizations/example.com/orderers/orderer.example.com/msp\
/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -v 1.0 \
-c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
[chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
[chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
No more errors. The chaincode is instantiated on the channel with initial value of ["init","a", "100", "b","200"].
5. Verify the instantiated chaincode:
bash-4.4# peer chaincode list -C mychannel --instantiated Get instantiated chaincodes on channel mychannel: Name: mycc, Version: 1.0, Path: github.com/chaincode/chaincode_example02/go/, \ Escc: escc, Vscc: vscc
⇒ Query Chaincode Property on BYFN Channel
⇐ Install Chaincode on BYFN Peers
2019-04-14, ∼6322🔥, 0💬
Popular Posts:
How to install "C++/CLI Support" component in Visual Studio? I need to build my Visual Studio C++/CL...
How to use the "set-body" Policy Statement for an Azure API service operation? The "set-body" Policy...
How To Pass Arrays By References? in PHP? Like normal variables, you can pass an array by reference ...
FYIcenter.com Online Tools: FYIcenter JSON Validator and Formatter FYIcenter JSON to XML Converter F...
Where to find tutorials on Python programming language? I want to learn Python. Here is a large coll...