I have stored a data let's say ABC
in the Ledger and got X123
as a Transaction hash in response. Now, I want to use this transaction hash X123
to fetch the data ABC
from the ledger. I found this package which provides the method QueryTransaction(txn_hash)
and states that QueryTransaction queries the ledger for processed transaction by transaction ID
My questions are:
- Is this a correct method to do the above operation? If no, Please suggest some methods.
If yes, Do I have to use some parsing logic to correctly format it?
Do we have parsing logic or decoder in
go-sdk
likeBlockDecoder
is there innode-sdk
?
the screenshot of the response that I'm getting using this method.
Download the fabric sample from
https://github.com/hyperledger/fabric-samples
Q1: In the Balance Transfer project. At the bottom of the
app.js
, all methods are already implemented.All the functions are defined in
Query.js
, please refer to this project.Q2: All requested data will be coming as JSON, so no need to parse.
Q3: Even fF you want to decode any .pb file, you a use configtxlator tool, Please make sure that you have configtxlater binary available. For decoding .pb file use following command For Envelope
For Block file