我正在尝试使用maxPriorityFeePerGas,maxFeePerGas正确地设置天然气价格(BSC区块链),但我总是收到一个错误:
ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}它只适用于我的gasPrice设置。我是不是做错了什么,或者这些方法还没有在web3 python中实现呢?
contract_tx = contract.functions.check([var1, var2, var3],[int1, int2, int3], sign_buy).buildTransaction(
{'nonce':nonce,
'gas': 250000,
# 'maxPriorityFeePerGas': web3.toWei(20,'gwei'),
# 'maxFeePerGas': web3.toWei(30,'gwei'),
'gasPrice': web3.toWei(8,'gwei')
}
)
signed_tx = web3.eth.account.signTransaction(contract_tx, pkey)
hash = web3.eth.send_raw_transaction(signed_tx.rawTransaction)web3 - 5.25.0
发布于 2022-01-06 19:43:02
很明显,你在处理遗留事务。文档说:
仅支持遗留交易的天然气价格策略。伦敦分叉引入了
maxFeePerGas和maxPriorityFeePerGas事务参数,只要有可能,这些参数就应该在gasPrice上使用。对于Ethereum (遗产)交易来说,天然气价格是一项微妙的财产。因此,Web3包含一个用于配置它的API。
https://stackoverflow.com/questions/70479320
复制相似问题