我正在使用 Infura 节点,因此我必须使用 w3.eth.account.sign_transaction
签署交易,然后使用 w3.eth.send_raw_transaction
发送它。
我使用的gas显然太低了,现在交易等待了8个小时。
通过查看文档,我注意到有两种方法可以帮助我 w3.eth.modify_transaction
和 w3.eth.replace_transaction
。这个想法是使用其中一个(虽然不确定它们之间有什么区别)来修改交易气体,以便得到确认。
问题是,我在文档中没有看到如何使用这两种方法之一并使用我的私有 key 签署修改后的事务,因为它们都对 eth_sendTransaction
进行了 RPC 调用,而这不受共享 Infura 节点。
回答1
https://web3py.readthedocs.io/en/latest/web3.eth.account.html#read-a-private-key-from-an-environment-variable,因此您不需要使用 send_raw_transaction
。