我可以通过hyperledger Fabric交易查看更改的内容吗?
我目前正在参与超级账本结构项目。
超级账本结构的概念仍然不够充分。据我所知,交易存储在区块中。交易知道链码已执行。
例如,假设您执行了发送链代码。假设 A 向 B 发送 500,其中 A = 1000,B = 1000。这将是 A = 500,B = 1500。假设这是 TxId = AAA。
我想在这种情况下查看 AAA 的“A 向 B 发送 500”的历史记录。通过运行当前网络创建的channel-artifact目录中的mychannel.block和mychannel。我尝试将tx解码为json文件。
但发现并没有与此相关的内容。有什么办法可以看到TxId=AAA的内容吗?
解码 .tx 和 .block 文件。但我没有得到我想要的。
I am currently participating in the hyperledger fabric project.
The concept of hyperledger fabric is still insufficient. I understand that the transaction is stored in the block. The transaction knows that the chaincode is executed.
For example, suppose you executed send chaincode. Suppose A sends 500 to B with A = 1000 and B = 1000. It will be A = 500 and B = 1500. Suppose this is TxId = AAA.
I want to see AAA's history of "A sent 500 to B" in this situation. Mychannel.block and mychannel in the channel-artifact directory created by running the current network.I tried to decode tx to json file.
However, it was found that there was no content related to this. Is there any way I can see the contents of TxId=AAA?
Decode .tx and .block file. but I didn't get what I wanted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想查看交易的历史记录,则可以使用ctx.stub.gethistoryforkey(ID)函数,其中ID参数为记录密钥。这是Node.js SDK方法,我希望它以Java和Go的名字命名。我认为您需要的信息应在合同中保留,因为历史记录只会随着时间的推移返回不同的合同版本。如果您想看到与B进行的交易,则需要合同代码来表明资金来自A并在转让期间与B降落。根据实施的不同,这可能需要对其他合同进行交叉合同呼叫(一个包含客户a和b),以便可以从帐户A基金中获取500,并添加到帐户B的基金中。在这种情况下(如果我们谈论的是销售),资产转移合同可以显示所有权的变化,而客户合同将显示2个更新,其中A基金减少了500,而B基金的基金增加了500
。上面的方案,现在有三个具有历史记录的更新,即您没有提及的资产销售,但是我以所有权历史记录的更改为示例。客户A的基金记录将减少,而客户b将有相应的资金增加。因此,这不是您需要的块历史记录,而是A和B的客户记录历史记录。即使您只有一个合同(客户),并且交换了资金,您仍然有两个更新,一个用于A和另一个用于B。合同代码中的记录更改。该块是整个交易的表现,即所有规则都被不同的同行所满足,以及任何合并策略的实现。
If you want to see the history of transactions, you can use the ctx.stub.getHistoryForKey(id) function, where the id parameter is a record key. This is the Node.js SDK method, I expect that it is similarly named for Java and Go. I think that the information that you require should be held in the contract, as the history only returns the different contract versions over time. If you want to see that A transacted with B, you would need the contract code to show that funds came from A and landed with B during the transfer. Depending on implementation, this might require a cross-contract call to a different contract (one containing clients A and B) so that 500 could be taken from Account A's fund and added to Account B's fund. In this scenario (if we are talking about a sale), the AssetTransfer contract could show the change of ownership, whereas the client contract will show 2 updates, one where A's fund decreases by 500 and another where B's fund increases by 500.
In the scenario above, there are now three updates that have history i.e. an asset sale, which you don't mention, but I am using as an example which will have a change of ownership history. A client A, whose fund record will have decreased, and a client B, who will have a corresponding increase in funds. Therefore, it's not a block history that you require, but a history of the Client records for A and B. Even if you only had a single contract e.g. (Client), and you exchanged funds, you will still have two updates, one for A and the other for B. It's the records within the contract code that change. The block is the manifestation of the entire transaction i.e. all rules have been satisfied by the different peers and whatever concensus policy is in place.