【发布时间】:2021-05-09 13:35:33
【问题描述】:
我想进行一些交易。喜欢提到here
sendRawTransaction 返回我交易的哈希值。但是没有任何交易。我的待处理事务计数为 0。当我使用该哈希调用 getTransaction 方法时,结果为
{
'blockHash': None,
'blockNumber': None,
'from': 'my address',
'gas': 118685,
'gasPrice': 1000000000,
'hash': HexBytes('some hash'),
'input': 'some long hash',
'nonce': 1254,
'r': HexBytes('...'),
's': HexBytes('...'),
'to': 'my contract address',
'transactionIndex': None,
'v': 42,
'value': 0
}
可能是什么原因?
【问题讨论】:
-
网络可能不接受交易。原因可能包括 gas 价格过低、nonce 不好等。如果你在调试模式下运行你自己的以太坊节点,比如 Geth,你可以从 Geth 日志中看到为什么他们不接受你的交易。
-
这是我的参数'nonce':w3.eth.getTransactionCount(account_address), gas = cont.functions.my_function(...).estimateGas() + 10000 我正在使用 infura。当我两次运行相同的代码时,我得到 ValueError: {'code': -32000, 'message': 'already known'}
-
你不能重复使用同一个随机数两次。
标签: python-3.x blockchain ethereum web3py