1

Looking at the fee structure of the EIP - 1559, I noticed we have such terms as maxPriorityFeePerGas and maxFeePerGas. I think maxPriorityFeePerGas is basically tip you pay the miner and maxFeePerGas is the maximum amount you are wiling to pay.

My question is, where does PerGas come from? Aren't they really maxPriorityFeePerGas and maxFeePerGas?

1 Answer 1

4

Gas is the measure of computation required to execute your transaction, depending on what functions your contract uses the gas used changes. This is analogous to the transaction bytes size in Bitcoin transactions.

The fees you set are how much gwei you are willing to pay for each gas unit, that's why it's PerGas. It's analogous to the satoshi/vbytes in Bitcoin transactions.

So for example, let's say my contract has a function that spends 130k gas and I set the maxFeePerGas to 50, then I'll be paying maximum 130000 * 50 = 6500000 gwei = 0.0065 ether.


And you're correct about maxPriorityFeePerGas and maxFeePerGas, but just to make it crystal clear:

maxPriorityFeePerGas is a tip you'll be paying to the miner so that your transaction is processed before others.

maxFeePerGas is the maximum you'll be paying in total as baseFeePerGas + PriorityFeePerGas, where baseFeePerGas is calculated by the protocol.

You always pay the baseFeePerGas, if that's below maxFeePerGas the rest will be paid to the miner if maxPriorityFeePerGas is above zero. The paid priority fee can be lower depending on the maximum fee set.

E.g.

70 = maxFeePerGas
30 = maxPriorityFeePerGas
50 = baseFeePerGas

You'll pay only 20 as priority fee because that's what's left between maximum and base fees.

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.