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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.