Tools, FAQ, Tutorials:
Instantiate PaperNet Chaincode (Smart Contract)
How to Instantiate the PaperNet Chaincode (Smart Contract), papercontract.js?
✍: FYIcenter.com
Now that papercontract chaincode containing the CommercialPaper
chaincode is installed on the required PaperNet peers,
you, as administrator, can make it available to different network channels,
so that it can be
invoked by applications connected to those channels. Because we’re using
the basic network configuration for PaperNet, we’re only going to make
papercontract available in a single network channel, mychannel.
1. Instantiate the chaincode:
(magnetocorp admin)$ cd ~/hyperledger-binaries/fabric-samples (magnetocorp admin)$ cd commercial-paper/organization/magnetocorp/contract (magnetocorp admin)$ docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract \ -v 0 -l node -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' \ -C mychannel -P "AND ('Org1MSP.member')" [chaincodeCmd] InitCmdFactory -> INFO 001 Retrieved channel (mychannel) \ orderer endpoint: orderer.example.com:7050 [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default escc [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default vscc ^C
You may need to press Ctrl-C to exit from the cliMagnetoCorp container.
Note that the orderer address orderer.example.com:7050 in the log message. This is because it additionally submits an instantiate transaction to the orderer, which will include the transaction in the next block and distribute it to all peers that have joined mychannel, enabling any peer to execute the chaincode in their own isolated chaincode container. Note that instantiate only needs to be issued once for papercontract even though typically it is installed on many peers.
2. Verify the instantiated chaincode:
(magnetocorp admin)$ docker exec cliMagnetoCorp peer chaincode list --instantiated -C mychannel Get instantiated chaincodes on channel mychannel: Name: papercontract, Version: 0, Path: /opt/gopath/src/github.com/contract, Escc: escc, Vscc: vscc
3. Verify the container that runs the instantiated chaincode:
(magnetocorp admin)$ docker ps | grep papercontract IMAGE STATUS NAMES dev-peer0.org1.example.com-papercontract-0-d96... Up 2 minutes dev-peer0.org1.example.com-papercontract-0
⇐ Install PaperNet Chaincode (Smart Contract)
2019-12-02, 1100🔥, 0💬
Popular Posts:
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
How to use "json-to-xml" Azure API Policy Statement? The "json-to-xml" Policy Statement allows you t...
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.d...
Where to see some Examples of Invalid JSON Values? Here are some Examples of Invalid JSON Values: 1....