I'm running the code in Chaincode for Developers Tutorial, to run a basic sample chaincode to create assets (key-value pairs) on the ledger.
I'm able to invoke the chaincode using the cli
peer chaincode invoke -n mycc -c '{"Args":["set", "a", "20"]}' -C myc
and also run queries
peer chaincode query -n mycc -c '{"Args":["query","a"]}' -C myc
Now I want to see how the key value pair gets stored in CouchDB. So I changed the environment variables below in the fabric-samples/chaincode-docker-devmode/docker-compose-simple.yaml
CORE_LEDGER_STATE_STATEDATABASE=CouchDB
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
I see the documents created like below in CouchDB UI (http://localhost:5984/myc/_all_docs) when I run set.
{
"total_rows": 3,
"offset": 0,
"rows": [{
"id": "lscc\u0000mycc",
"key": "lscc\u0000mycc",
"value": {
"rev": "1-dc6dc8ff92efd35358cf5b89e7949c25"
}
},
{
"id": "mycc\u0000a",
"key": "mycc\u0000a",
"value": {
"rev": "3-7ad1349ec711a99a2a2f1dd1c8b08a20"
}
},
{
"id": "statedb_savepoint",
"key": "statedb_savepoint",
"value": {
"rev": "6-2c3d131fc75772cc9e70311998bdde9d"
}
}
]
}
How/Where is the value for the key stored and retrieved? It is seen as below, when checking the document in the DB, but is retrieved properly when running the chaincode get query.
"value": {
"rev": "3-7ad1349ec711a99a2a2f1dd1c8b08a20"
}