My system keeps track of ETH wallets in a local DB. It is preferable that I know exactly what the fee is beforehand, so I can update the DB before broadcasting, and then rollback if anything goes wrong. I prefer not to update the DB after broadcasting, because I don't want to wait until broadcasting is done.

Since I'm using EIP-1559 transactions, the GWei spent per gas has become unpredictable. The following variables are relevant here:

  • maxFeePerGas = how much GWei is spent in total per unit of gas
  • maxPriorityFeePerGas = how much GWei is spent for miner tips

So I don't want to broadcast a transaction where maxFeePerGas = 20 and maxPriorityFeePerGas = 2, and then see that the ETH blockchain consumed 14.87458745887485 GWei per gas. I want it to have consumed 20 as I have defined beforehand.

maxFeePerGas - maxPriorityFeePerGas = baseFeePerGas

As far as I know the maxPriorityFeePerGas is always consumed in full, so it is a predictable amount. Therefore I was wondering, what if I always just set maxFeePerGas = maxPriorityFeePerGas? Then I will always know beforehand precisely how much fee is consumed, and I don't have to update my DB after the fact.

The only downside I can think of is that I would pay a bit too much fee every time, because for the base fee, the ETH blockchain only uses as much as it needs. Is this possible? Are there other downsides I'm missing?

1 Answer 1


Coming back here after 7 months and having learned a lot more, the answer is simply "No".

maxPriorityFeePerGas is predictable, but it's only for the miners. The ETH Blockchain itself must use baseFeePerGas, and it will decide for itself what that fee is in a non-greedy way when the block is being mined. There's no way to predict this number, so the total fee has to be obtained after the block is mined.

The only control you have over it is how much fee at most the ETH Blockchain may consume, which is the max limit you set as maxFeePerGas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.