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
Â
⇒ Client Application Gateway
⇠Install PaperNet Chaincode (Smart Contract)
⇑ commercial-paper Sample Network
⇑⇑ Hyperledger Tutorials
2019-12-02, 860👍, 0💬
Popular Posts:
How to use the JSON to XML Conversion Tool at utilities-online.info? If you want to try the JSON to ...
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
How to add request query string Parameters to my Azure API operation 2017 version to make it more us...
How to build a test service operation to dump everything from the "context.Request" object in the re...
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...