通过TXHASH检查交易,并确认用户是否转移了适当的金额

发布于 2025-02-06 05:15:21 字数 1253 浏览 3 评论 0 原文

在Rinkeby网络中检查交易时,我会面临问题。

概述:我有一个交易哈希(TXHASH),所以我想知道用户是否以特定的数量从钱包转移到我的钱包。

因此,我连接到RPC并拥有提供商,我通过使用getTransactionReceipt函数获得了交易的完整信息,并使用ABI JSON来解析编码的数据,

但是,有些交易具有1个日志,其他人有2个日志,3,4 ...日志,交易的价值数量在响应的日志中,那么我现在该怎么办? check data at logs[0] or foreach the logs and find the right log

For example,

我有1个日志,交易成功

”在此处输入图像“

https://rinkeby.etherscan .io/tx/0x9305efb42f70d4289fcf39c6f8377855deeef512b12af654f31815a714722186#eventlog 我有4个日志,交易成功,但没有显示细节

I am facing a problem when checking a transaction in the Rinkeby network.

Overview: I have a transaction hash (txHash), so I want to know if users transfer from their wallet to my wallet with a specific amount.

So I connect to rpc and have the provider, I got the full info of transaction by using getTransactionreceipt function, and use abi json to parse the data encoded,

BUT, some transaction have 1 logs, others has 2,3,4... logs, and the value amount of transaction is in logs of response, so what should I do now? check data at logs[0] or foreach the logs and find the right log

For example,

https://rinkeby.etherscan.io/tx/0xd0296c60df12ccdcdb5fab3d61c4c05c22820d543a76bf741b4ee6f8565f3327
I get 0 logs , transaction success
logs

https://rinkeby.etherscan.io/tx/0x50df0b293537ab076b7738fe6205239bf1a3e39510667d5ffe20d4dbb7b0fc09
I get 1 logs , transaction success

enter image description here

https://rinkeby.etherscan.io/tx/0x9305efb42f70d4289fcf39c6f8377855deeef512b12af654f31815a714722186#eventlog
I get 4 logs , transaction success but not show detail
enter image description here

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

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

发布评论

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

评论(1

小瓶盖 2025-02-13 05:15:21

以我的经验,交易有两种不显示日志的可能性,一个是收件人不是合同,另一个是合同的创建者不使用事件函数作为您所调用的方法。 :)

In my experience, there are two possibilities for transactions not to show logs, one is that the recipient is not a contract, and the other is that the creator of the contract doesn't use event functions for the methods you call. :)

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