I just set up a Hyperledger Fabric.network (2.2) with chaincode(node.js) for me and my team.
We are using Hyperledger SDK for NodeJS (Version 2.2) for.network interaction.
Now the problem is, we need to query block data for all transactions in the.network.
How can we get all existing blocks and query them?
With SDK 1.4, there was channel.getBlockbyTXid().
Is there a solution for the newest SDK Version?
Use the QSCC
Chaincode and invoke functions like GetBlockByNumber
and GetTransactionByID
.
Example
const network = await gateway.getNetwork("mychannel");
const contract = network.getContract("qscc");
let result = await contract.evaluateTransaction("GetBlockByNumber", channelName, blkNum);
// or
let result = await contract.evaluateTransaction("GetTransactionByID", channelName, txId);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.