Reputation: 1189
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:
If yes, Do I have to use some parsing logic to correctly format it?
Do we have parsing logic or decoder in go-sdk
like BlockDecoder
is there in node-sdk
?
the screenshot of the response that I'm getting using this method.
Upvotes: 0
Views: 772
Reputation: 771
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
configtxlator proto_decode --input your_file.pb --type common.Envelope
For Block file
configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json
Upvotes: 1