【问题标题】:web3py maxPriorityFeePerGas doesn't work?web3py maxPriorityFeePerGas 不起作用?
【发布时间】:2021-12-25 10:18:47
【问题描述】:

我正在尝试使用 maxPriorityFeePerGas、maxFeePerGas 正确设置 gas 价格(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

【问题讨论】:

标签: python web3py


【解决方案1】:

显然,您正在处理遗留事务。 Documentation 说:

Gas 价格策略仅支持旧交易。这 伦敦叉介绍了maxFeePerGasmaxPriorityFeePerGas 任何时候都应该在gasPrice 上使用的事务参数 可能的。 对于以太坊(遗留)交易,gas 价格是一个微妙的属性。 出于这个原因,Web3 包含一个用于配置它的 API。

【讨论】:

    猜你喜欢
    • 2021-09-29
    • 2022-08-16
    • 2023-01-24
    • 2021-09-04
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    相关资源
    最近更新 更多