如何在面料中获得所有过去的交易?

发布于 2025-02-01 16:16:31 字数 163 浏览 2 评论 0原文

目前,我正在研究Fabric SDK。我想在客户端将过去的所有织物交易获得。

示例:我已经有1个已安装的链代码。在面料上,我称为delete_user和edit_user方法。我希望所有这些交易都在客户端,而不会存储在Offchain DB中。

任何人都可以建议使用节点SDK方法吗?

As currently, I'm working on fabric SDKs. I want to get all the past transactions of fabric on the client-side.

Example: I already have 1 installed chain code. On fabric, I called delete_user and edit_user methods. I want those all transaction on client side without storing in offchain DB.

Can anyone suggest Node SDK method for the same?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你在我安 2025-02-08 16:16:31

每个事务功能都会发出一个适当命名的链码事件(例如“删除器”和“ edituser”)。仅当交易成功投入并更新分类帐时,链码事件才会发出。您的客户端应用程序可以侦听这些链代码事件,并在每个链代码事件上采取行动。

您可以开始聆听特定块号的链码事件,以重播历史事件。您可能还需要使用“ checkpointer”(或滚动自己的)机制来持续使用侦听器的块数量和事务ID,您的侦听器最后一次处理了处理,以便您可以从应用程序重新启动后完全从同一点恢复侦听。这将使您能够精确处理每个链代码事件,而无需重复或错过事件。

请参阅这些织物样品以获取示例:

Have each transaction function emit a suitably named chaincode event (such as "deleteUser" and "editUser"). The chaincode event gets emitted be peers only when the transaction is successfully committed and updates the ledger. Your client application can listen for those chaincode events and take action on each chaincode event.

You can start listening for chaincode events from a specific block number to replay historic events. You may also want to use a "checkpointer" (or roll-your-own) mechanism for persisting the block number and transaction ID your listener last successfully processed so you can resume listening from exactly the same point after an application restart. This would allow you to process each chaincode event exactly once, with no duplication or missed events.

See these Fabric samples for examples:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文