Tools, FAQ, Tutorials:
Query Chaincode Property on BYFN Channel
How to Query Chaincode Property on BYFN Channel?
✍: FYIcenter.com
An instance of a chaincode can be viewed as an object
of a class in an execution environment.
It can hold properties.
You can run the "peer chaincode query" command to query the current value of a given property of a given chaincode instance.
1. Verify instantiated chaincode:
$ docker exec -it cli bash bash-4.4# echo $CORE_PEER_ADDRESS peer0.org2.example.com:7051 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
2. Query property "a" and "b" of instantiated chaincode "mycc":
bash-4.4# peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
100
bash-4.4# peer chaincode query -C mychannel -n mycc -c '{"Args":["query","b"]}'
200
3. Query an unknown property "c":
bash-4.4# peer chaincode query -C mychannel -n mycc -c '{"Args":["query","c"]}'
Error: endorsement failure during query. response: status:500 \
message:"{\"Error\":\"Nil amount for c\"}"
4. Query an unknown chaincode instance:
bash-4.4# peer chaincode query -C mychannel -n mycc_x -c '{"Args":["query","a"]}'
Error: endorsement failure during query. response: status:500 \
message:"make sure the chaincode mycc_x has been successfully instantiated \
and try again: chaincode mycc_x not found"
⇒ Invoke Chaincode Transaction on BYFN Channel
⇐ Instantiate Chaincode on BYFN Channel
2020-09-30, ∼1440🔥, 0💬
Popular Posts:
How To Read a File in Binary Mode in PHP? If you have a file that stores binary data, like an execut...
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...
What is EPUB 3.0 Metadata "dc:description" Element? EPUB 3.0 Metadata "dc:description" is an optiona...
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...