A Definitive Guide to Ethereum EIP-1559 Gas Fee Calculations: Base Fee, Priority Fee, Max Fee
When Ethereum upgraded its core gas-fee marketplace with EIP-1559, transactions moved from a first-price auction to a hybrid system involving base fees and tips. As we have previously covered, this introduced new levels of complexity for transacting on-chain.
To help further clarify this, today we will explain the new terms and how to approach the core variables associated with EIP-1559 transaction fees.
The New Terminology of EIP-1559 Transactions
First, a refresher: EIP-1559 changed how Ethereum transaction fees are calculated and where those fees go. Instead of a singular
Gas Price, you now have to pay attention to three separate values:
Base Fee, which is determined by the network itself. And is subsequently burned.
Max Priority Fee, which is optional, determined by the user, and is paid directly to miners.
Max Fee Per Gas, which is the absolute maximum you are willing to pay per unit of gas to get your transaction included in a block. For brevity and clarity, we will refer to this as the
Transactions that include these new fields are known as
, while legacy transactions that carry the original
Gas Price field remain supported and known as
Type 0. Note: EIP-1559 does not bring changes to the
Gas Limit, the maximum amount of gas the transaction is authorized to consume.
Determining the Base Fee
Base Fee is determined by the Ethereum network rather than being set by end-users looking to transact or miners seeking to validate transactions. The
Base Fee targets 50% full blocks and is based upon the contents of the most recent confirmed block. Depending on how full that new block is, the
Base Fee is automatically increased or decreased.
- If the last block was exactly 50% full, the
Base Feewill remain unchanged.
- If the last block was 100% full, the
Base Feewill increase by the maximum 12.5% for the next block.
- If the last block was more than 50% full but less than 100% full, the
Base Feewill increase by less than 12.5%.
- If the last block was 0% full – that is, empty – the Base fee will decrease the maximum 12.5% for the next block.
- If the last block was more than 0% full but less than 50% full, the
Base Feewill decrease by less than 12.5%
This new mechanism is meant to help smooth transaction fees and prevent sudden spikes. The most important thing to keep in mind when it comes to the
Base Fee: it is 100% automatic and readable directly from the network.
Setting a Priority Fee
Max Priority Fee — also often referred to as the miner tip — is an 'optional' additional fee that is paid directly to miners in order to incentivize them to include your transaction in a block. While the
Max Priority Fee is technically optional, at the moment most network participants estimate that transactions generally require a minimum 2.0 GWEI tip to be candidates for inclusion. With that said, specific mining pools may choose to set alternative minimums for inclusion.
For 'typical' transactions that are submitted under normal, not-congested network conditions, the
Max Priority Fee will need to be close to 2.0 GWEI. But, for transactions where order or inclusion in the next block is important, or when the network is highly congested, a higher
Max Priority Fee may be necessary to prioritize your transaction.
A somewhat subtle nuance to the
Max Priority Fee is that it represents the maximum tip you are willing to pay to a miner. However, if the
Base Fee plus the
Max Priority Fee exceeds the
Max Fee (see below), the
Max Priority Fee will be reduced in order to maintain the upper bound of the
Max Fee. This means the actual tip may need to be smaller than your
Max Priority Fee and, under such circumstances, your transaction may become less attractive to miners.
Calculating the Max Fee
Now that we have covered the basics of the
Base Fee and the
Max Priority Fee, we can tackle the somewhat counterintuitive notion of the
Max Fee is the absolute maximum amount you are willing to pay per unit of gas to get your transaction confirmed. And here is where things can get a little confusing – given that, under most circumstances, your actual transaction fee will be less than the
Max Fee you specify up front. Here is why:
- The minimum gas price for your transactions is the current
- However, what if the
Base Feeincreases while your transaction is pending? Your transaction will become underpriced and be at risk of becoming stuck. Or failing. Or getting dropped. This is undesirable for all of the reasons you might expect.
- Hence, for predictable transaction settlement under EIP-1559, it is currently considered best practice to set a
Max Feethat anticipates such an increase in the
Base Fee. But by how much? And why?
- Our EIP-1559-compliant Gas Estimator currently uses the following simple heuristic to calculate the recommended
Max Feefor any given
Max Priority Feecombination:
Max Fee= (2 *
Base Fee) +
Max Priority Fee
Base Fee when calculating the
Max Fee ensures that your transaction will remain marketable for six consecutive 100% full blocks. The table below illustrates why.
An Illustrative Example: From Marketable to Unmarketable in Six Blocks
Assume your transaction is submitted during Block 1, when the
Base Fee is 100.0 GWEI. You choose to set a
Max Priority Fee of 2.0 GWEI, so your
Max Fee calculation is (2 * 100.0 + 2.0) or 202.0 GWEI.
But, just as you are submitting your transaction, a high profile NFT drop happens and network demand surges. Suddenly, every block is 100% full – rather than the 50% target discussed above – so the Base Fee increases by the maximum 12.5% per block.
|Block||Base Fee||% Full||Increase in Base Fee||Priority Fee specified||Max Fee specified||Gas Price Paid if confirmed||Gas 'Saved'|
As you can see, it takes six consecutive 100% full blocks for the
Base Fee to double – in this case, from 100.0 GWEI to 202.7 GWEI.
Practically speaking, by setting your
Max Fee in this manner, your transaction is 'protected' against becoming underpriced and hence unmarketable in the event of the most rapid escalation of the
Base Fee possible.
But what if the Base Fee does not increase so rapidly? You will be charged less than the Max Fee you specified. To see why, refer to the table above:
- Remember, your transaction was submitted during Block 1, when the
Base Feewas 100.0 GWEI. You chose to set a
Max Priority Feeof 2.0 GWEI, so your
Max Feecalculation was 202.0 GWEI.
- Your transaction is
Confirmedduring Block 4, when the
Base Feeis 142.2 GWEI.
- Your transaction fee is determined by the price of the
Base Feewhen confirmed plus your
Max Priority Fee. So you will pay 144.2 GWEI per gas for the transaction.
- This is 57.6 GWEI per gas less than the
Max Feeyou specified. That 57.6 GWEI per gas is effectively 'saved' and will remain in your wallet.
- It is worth noting that your
Max Feeis not 'withdrawn' from your wallet and then some portion is 'refunded'. Instead, imagine that the
Max Feeis the 'maximum authorized charge' threshold.
- If you transaction was not confirmed before Block 6, it would become unmarketable – and no longer a candidate for inclusion – during Block 7 since its
Max Feeof 202.0 GWEI falls just below the new
Base Feeof 202.7 GWEI.
Finally, in the scenario above, what if you failed include the 2x safety factor in your
Max Fee calculation and instead set the
Max Fee to the minimum of 102.0 GWEI?
- Your transaction would be marketable during Block 1 since your
Max Feeis still above the
Base Feeof 100.0 GWEI.
- However, by Block 2 your transaction would become underpriced because its
Max Feefalls below the new
Base Feeof 112.5 GWEI.
- Your transaction would remain
Base Feedecreases and falls below its
Max Feeof 102.0 GWEI.
- Or, if the network is highly congested, your transaction might get dropped altogether.
And this is why the
Max Fee is counterintuitive:
- Most of the time – and likely the vast majority of the time – you will pay less in transaction fees than your
- But sometimes, particularly during periods of high network congestion, you will be charged your
- If you roll the dice and set your
Max Feetoo close to the current
Base Fee, you run the risk of your transaction becoming underpriced and hence no longer eligible for inclusion.
For predictable transaction settlement performance, we recommend incorporating a healthy safety factor in your
Max Fee calculations.
EIP-1559 in MetaMask
By default, version 10.0.0 of MetaMask will automatically set your transaction's
Max Priority Fee. You can override these with the EDIT button, which will allow you to select low (slowest to confirm), medium, or high (fastest to confirm) fees:
To manually specify your transaction's
Max Priority Fee, and
Max Fee, select the Advanced Options drop down.
Blocknative Helps You Set EIP-1559 Transaction Fees with Confidence
Blocknative is here to help. Our Gas Estimator – which is powered by our industry-leading Gas Platform API – fully supports EIP-1559. Gas Platform inspects every pending Ethereum transaction to help you accurately estimate transaction fees to get included in the next block.
Please stay tuned for updates as we expand and refine our support for EIP-1559 across our portfolio, including enhancements to how best to calculate your
Are there other aspects of EIP-1559 you would like us to cover? Or is this post missing something? Please join our Discord Community if you have questions, concerns, or recommendations.