Type to search

Latest News Tools and Charts Trading Tips

Ethereum Gas Fee?

Ethereum changed how it calculates and handles ๐ ๐š๐ฌ ๐Ÿ๐ž๐ž๐ฌ with ๐„๐ˆ๐-๐Ÿ๐Ÿ“๐Ÿ“๐Ÿ—. It makes understanding (and explaining) how gas works on Ethereum even more complex

But you should understand it. So here we go…

First, letโ€™s understand how gas USED to work. To understand gas, you needed to know three things:

1) ๐†๐š๐ฌ ๐œ๐จ๐ฌ๐ญ โ€” the amount of computation and storage used by a transaction, measured in units of โ€gasโ€œ Think of this as the number of gallons of gas you need to fuel your car for a road trip…except in our case, this is the gas required to fuel the Ethereum transaction ๐Ÿ™‚

2) ๐†๐š๐ฌ ๐ฉ๐ซ๐ข๐œ๐ž โ€” the cost per unit of gas that the sender is willing to pay Think of this as the price per gallon of gas you are willing to pay

๐๐จ๐ญ๐ž: Gas prices are denoted in ๐ ๐ฐ๐ž๐ข, which is equal to 0.000000001 ETH (10^9 ETH) Instead of saying that your gas costs 0.000000001 ether, you can say your gas costs 1 gwei

3) ๐†๐š๐ฌ ๐ฅ๐ข๐ฆ๐ข๐ญ โ€” the max amount of gas a sender is willing to use for that transaction (i.e. upper bound for gas cost) Think of this as the maximum number of gallons of gas you are willing to buy to justify the road trip. If it goes over, you cancel the road trip…

Or in the case of Ethereum, the transaction is reverted.

Therefore, your โ€œ๐“๐ซ๐š๐ง๐ฌ๐š๐œ๐ญ๐ข๐จ๐ง ๐Ÿ๐ž๐žโ€ was calculated as:

๐†๐š๐ฌ ๐œ๐จ๐ฌ๐ญ ๐ฑ ๐†๐š๐ฌ ๐ฉ๐ซ๐ข๐œ๐ž

 

Let’s say Alice wants to pay Bob 3 ETH. A simple ETH transfer costs 21,000 units of gas. Let’s assume the current gas price is 300 gwei (gas price changes based on the demand on the network)

Transaction fee = 21,000 gas x 300 gwei = 6,300,000 gwei or 0.0063 ETH

This entire transaction fee would go to miners for including your transaction in a block.

But ever since the London hard fork and implementation of EIP-1559 in early August 2021, there is a ๐ง๐ž๐ฐ ๐ฆ๐ž๐ญ๐ก๐จ๐ for calculating transaction fees Transactions moved from a blind auction system to a hybrid system with โ€œbase feesโ€ and โ€œtipsโ€

Instead of keeping track of the ๐ ๐š๐ฌ ๐ฉ๐ซ๐ข๐œ๐ž, we now have to keep track of 3 different variables:

๐๐š๐ฌ๐ž ๐…๐ž๐ž โ€” as the name sounds, this is the base fee per unit of gas that is used in that transaction This fee is determined by the Ethereum network itself This โ€œfeeโ€ is subsequently ๐›๐ฎ๐ซ๐ง๐ž๐

๐Œ๐š๐ฑ ๐๐ซ๐ข๐จ๐ซ๐ข๐ญ๐ฒ ๐…๐ž๐ž โ€” an optional tip that is paid directly to miners

(NOTE: The tip would be calculated as Max priority fee x Gas cost)

๐Œ๐š๐ฑ ๐…๐ž๐ž ๐๐ž๐ซ ๐†๐š๐ฌ โ€” the absolute maximum you are willing to pay per unit of gas to get your transaction included in a block (this is similar to โ€œGas priceโ€, except now it includes both the Base Fee + Max Priority fee)

๐†๐š๐ฌ ๐ฅ๐ข๐ฆ๐ข๐ญ stays the same, which is the max units of gas a sender is willing to use for that transaction ๐†๐š๐ฌ ๐œ๐จ๐ฌ๐ญ also stays the same, which is the amount of gas used by the transaction

Therefore.. ๐“๐ซ๐š๐ง๐ฌ๐š๐œ๐ญ๐ข๐จ๐ง ๐Ÿ๐ž๐ž = (Base Fee + Max Priority fee) x Gas cost

Letโ€™s look at a little closer at Base fee, Max priority fee, and Max fee per gas

The base fee that is set by the Ethereum network aims to have 50% full blocks. Depending on how full the last block was, the Base Fee is automatically increased or decreased

If the last block was…

๐Ÿ“๐ŸŽ% ๐Ÿ๐ฎ๐ฅ๐ฅ โ†’ Base Fee will remain unchanged

๐Ÿ๐ŸŽ๐ŸŽ% ๐Ÿ๐ฎ๐ฅ๐ฅ โ†’ Base Fee will increase by the maximum 12.5% for the next block

๐ŸŽ% ๐Ÿ๐ฎ๐ฅ๐ฅ โ†’ Base fee will decrease by a maximum of 12.5% for the next block

๐๐ž๐ญ๐ฐ๐ž๐ž๐ง ๐Ÿ“๐Ÿ% – ๐Ÿ—๐Ÿ—% ๐Ÿ๐ฎ๐ฅ๐ฅ โ†’ Base Fee will increase by less than 12.5%

๐๐ž๐ญ๐ฐ๐ž๐ž๐ง ๐ŸŽ% – ๐Ÿ“๐ŸŽ% ๐Ÿ๐ฎ๐ฅ๐ฅ โ†’ Base Fee will decrease by less than 12.5%

By automatically setting the base fee based on the current block fullness, the goal is to help prevent sudden spikes in transaction fees

Moreover, all of the transaction fees collected from base fees is ๐๐”๐‘๐๐„๐ƒ (i.e. ETH supply is reduced)

The Max Priority Fee (i.e. โ€œminer tipโ€) is optional fee that is paid directly to miners in order to incentivize them to include your transaction in a block.

While it is optional, it is unlikely that your transaction will be included unless you set the max priority fee to some minimum

At the moment, Metamask defaults max priority fee to ๐Ÿ.๐Ÿ“ ๐ ๐ฐ๐ž๐ข for a simple value transfer at “Medium” priority

If you want miners to prioritize your transactions, you probably want to increase your tip.

Now, there is one subtly to understand here:

The Max Priority Fee is the ๐ฆ๐š๐ฑ๐ข๐ฆ๐ฎ๐ฆ ๐ญ๐ข๐ฉ you are willing to pay a miner

However, if the Base Fee + Max Priority Fee exceeds the Max Fee per Gas, the ๐Œ๐š๐ฑ ๐๐ซ๐ข๐จ๐ซ๐ข๐ญ๐ฒ ๐…๐ž๐ž ๐ฐ๐ข๐ฅ๐ฅ ๐›๐ž ๐ซ๐ž๐๐ฎ๐œ๐ž๐ so that your total fee is still below the Max fee per Gas…

This means the actual tip you end up paying to the miner might be smaller than your Max Priority Fee (e.g. if the Base Fee increases a lot by the time your transaction is included)

This is why it is currently considered best practice to set a Max Fee per gas that ๐š๐ง๐ญ๐ข๐œ๐ข๐ฉ๐š๐ญ๐ž๐ฌ ๐ฌ๐ฎ๐œ๐ก ๐š๐ง ๐ข๐ง๐œ๐ซ๐ž๐š๐ฌ๐ž ๐ข๐ง ๐ญ๐ก๐ž ๐๐š๐ฌ๐ž ๐…๐ž๐ž so that your transaction is attractive to miners even if the Base fee goes up

IF you are still paying attention, kudos to you ๐Ÿ˜‰

 

Source :ย 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *