2

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

  • Does this answer your question? [ValueError: Method eth\_maxPriorityFeePerGas not supported, web3.py with ganache](https://stackoverflow.com/questions/70104101/valueerror-method-eth-maxpriorityfeepergas-not-supported-web3-py-with-ganache) – Rouhollah Joveini Feb 01 '22 at 08:41

2 Answers2

0

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.

funnydman
  • 9,083
  • 4
  • 40
  • 55
0

The Web3py docs also specify the following:

Whoa there, Binance Smart Chain user! Web3.py is an Ethereum-specific library, which now defaults to “type 2” transactions as of the London network upgrade. BSC apparently does not support these newer transaction types.

From issues opened, it seems BSC transactions must include gasPrice, but not type, maxFeePerGas, or maxPriorityFeePerGas. If you have trouble beyond that, please find an appropriate BSC forum to raise your question. https://web3py.readthedocs.io/en/v5/web3.eth.html#module-web3.eth

crypto
  • 1
  • 2