使用Web3.Py等待交易确认?

发布于 2025-02-10 01:45:21 字数 242 浏览 2 评论 0 原文

我正在使用以下方式发送交易:

sign_txn = web3.eth.account.signTransaction(token_tx, private_key=private_key)
tx_hash = web3.eth.sendRawTransaction(sign_txn.rawTransaction)

我想等待交易的确认继续我的脚本工作,我该怎么做,以免在交易已经完成时浪费额外的时间等待验证?

I am sending a transaction using:

sign_txn = web3.eth.account.signTransaction(token_tx, private_key=private_key)
tx_hash = web3.eth.sendRawTransaction(sign_txn.rawTransaction)

and I want to wait for the confirmation of the transaction to continue the work of my script, how can I do this so as not to lose extra time waiting for verification when the transaction is already completed?

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

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

发布评论

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

评论(1

哭了丶谁疼 2025-02-17 01:45:21

我可能会误解您,

但是IS web3.ETH.GEG_TRANSACTION_RECEIPT()您在寻找什么?

如果不是,请澄清一下您期望的结果:)

I might misunderstand you,

but is web3.eth.get_transaction_receipt() what you are looking for?

https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.get_transaction_receipt

if not, please clarify what result you are expecting :)

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