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
⇑ BYFN (Build Your First Network)
⇑⇑ Hyperledger Tutorials
2019-04-14, 4937👍, 0💬
Popular Posts:
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
How to use the XML to JSON Conversion Tool at freeformatter.com? If you want to try the XML to JSON ...
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.d...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...
How To Submit Values without Using a Form in PHP? If you know the values you want to submit, you can...