web3py maxPriorityFeePerGas doesn't work?

Viewed 974

I'm trying to setup gas price properly (BSC blockchain) using maxPriorityFeePerGas, maxFeePerGas but I always receive an error:

ValueError: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}

It works for me only with gasPrice setup. Am i doing something wrong or these methods isn't implemented in web3 python yet?

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

1 Answers

Apparently, you're dealing with legacy transactions. Documentation says:

Gas price strategy is only supported for legacy transactions. The London fork introduced maxFeePerGas and maxPriorityFeePerGas transaction parameters which should be used over gasPrice whenever possible. For Ethereum (legacy) transactions, gas price is a delicate property. For this reason, Web3 includes an API for configuring it.

Related