Querying transaction content out from a blockchain network is a common practice used by common scenarios like exploring the blockchain history or verifying the blockchain transaction content from a known ID. In Hyperledger Fabric, the transaction can be queried using a special system chaincode QSCC (Query System Chaincode) which is for ledger and other Fabric-related queries. For querying transaction by its ID, we can query/invoke the GetTransactionByID function from QSCC.
从区块链 网络中查询交易内容是常见场景使用的一种惯例,例如探索区块链历史或从已知ID验证区块链交易内容。 在Hyperledger Fabric中,可以使用特殊的系统链代码QSCC(查询系统链代码)查询交易,该系统链代码用于分类帐和其他与Fabric相关的查询。 为了通过其ID查询事务,我们可以从QSCC查询/调用GetTransactionByID函数 。
This tutorial assumes you have just finished installing Hyperledger Fabric 2.0 in Ubuntu 18.04 and we introduce the steps using the test-network.
本教程假定您刚刚在Ubuntu 18.04中完成Hyperledger Fabric 2.0的安装,并且我们将介绍使用测试网络的步骤。
更改工作目录并设置环境 (Change the working directory and set up the environment)
First change the working directory to the test-network
directory from the fabric-samples repository which was pulled by the installation script during installing Hyperledger Fabric 2.0 following the tutorial mentioned above.
首先,按照上述教程,在安装Hyperledger Fabric 2.0的过程中将工作目录从fabric-samples存储库更改为test-network
目录,该存储库是由安装脚本提取的。
$ cd $GOPATH/src/github.com/hyperledger/fabric-samples/test-network
Set up the environment variables correctly so that the peer
command can work correctly.
正确设置环境变量