Skip to content

How can I get blockInfo by txId #504

Answered by bestbeforetoday
artz001 asked this question in Q&A
Discussion options

You must be logged in to vote

You can evaluate the GetBlockByTxID transaction function on the qscc system chaincode. The qscc system chaincode is not well documented but the implementation is here:

https://github.com/hyperledger/fabric/blob/main/core/scc/qscc/query.go

GetBlockByTxID takes two arguments: channel name and transaction ID. It returns a serialized Block protocol buffer message. You can deserialize this using the fabric-protos language bindings for the Fabric protocol buffer messages:

var block = org.hyperledger.fabric.protos.common.Block.parseFrom(responseBytes);

The off_chain_data sample demonstrates how to navigate the block structure and retrieve information. You might want to reuse some or all of the p…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bestbeforetoday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #503 on November 07, 2022 11:38.