Reputation: 47
So if we take an example of HL Fabric 'fabCar' example, it work very well , but it only play with the world state(couchdb). All the read and write operation are happening on worldstate . But I want to interact with the ledger so that I can read / write through the ledger or even see the whole transaction on the ledger. How to interact with the ledger to read and write the data on it.
I have tried to find the solution but nowhere getting the simple solution. It says use to system chaincode to interact with the ledger but not saying how.
To interact with the ledger to read and write the data on it.
Upvotes: 0
Views: 68
Reputation: 12053
The state database is a cache of the latest version / value of any given key. There's no reason for chaincode itself to interact with the file-based ledger directly (this would result in terrible performance). This is how almost all blockchains work. If you want to see blocks and transactions, there are APIs you can use to access them. You can either invoke qscc directly or use the SDK wrapper functions (e.g. https://fabric-sdk-node.github.io/release-1.4/Channel.html#queryBlock__anchor ) to retrieve them. But again, there's no reason to do this from within chaincode itself.
Upvotes: 2