为什么煤气费不起作用?如果我不收煤气费,交易就成功了。但是,如果我加上煤气费,交易就会失败,并返回错误:
{“代码”:-32000,“消息”:“内部气体太低”}
web3matic = Web3(Web3.HTTPProvider(matic))
nonce = web3matic.eth.get_transaction_count(walletAddress)
result = contract.functions.buy(item, int(price)).buildTransaction({
'from': walletAddress,
'nonce': nonce,
'gas': 21000,
'gasPrice': web3matic.toWei(700, 'gwei'),
})
print(result)发布于 2022-05-11 04:02:33
尝试将gas设置为3000000并使用w3.eth.gasPrice for gasPrice
背景:在2021年10月,多边形将1千兆吨的最低天然气价格提高到了30英镑。
web3matic = Web3(Web3.HTTPProvider(matic))
nonce = web3matic.eth.get_transaction_count(walletAddress)
result = contract.functions.buy(item, int(price)).buildTransaction({
'from': walletAddress,
'nonce': nonce,
'gas': 3000000,
'gasPrice': web3matic.eth.gasPrice,
})
print(result)https://stackoverflow.com/questions/71596147
复制相似问题