Ethereum Gas ELI5
A lot of people find gas confusing. Gwei, priority fee, burning, inflation... Let's understand it once and for all!
A lot of people find gas confusing. Gwei, priority fee, burning, inflation... Let's understand it once and for all!
I believe that before getting into any details, we should understand the point of gas and burning fees in the first place. I don’t think most people truly consider from first principles what the point of burning ETH is.
Why is ETH burned?
Forums online will give various reasons, but when you fundamentally get down to it, it is to give ETH sustainable value.
Let’s compare with Bitcoin first to understand this better. Bitcoin has all the fees go to the miners. Eventually, miners won’t get block rewards, and have to survive off of transaction fees. There is a big debate as to whether this will be sustainable, and that miners may stop mining because of a lack of rewards.
I think Ethereum’s founders recognized this risk and put no supply cap; the protocol infinitely mints rewards to validators. The problem is that this creates inflation. So why is ETH burned?
ETH is burned to counteract this inflation (for ETH value accrual).
Requiring ETH in transactions gives it financial value (for ETH value accrual).
Think back to why BTC is required in transactions. It’s to reward miners, especially for the future in which block rewards taper off. Ethereum doesn’t have this problem because block rewards will always be there. So why require ETH as a transaction fee if validators are already rewarded from block rewards? Requiring it helps give ETH a use case, and thus financial value.
Requiring ETH helps control spam transactions and infinite loop computations (a practical requirement).
So three primary reasons in my view that ETH is burned. Two of which, when you peel the onion, is ultimately a value accrual mechanism. Vitalik himself talks about what is necessary to accrue value to ETH, so there is no question that this is a consideration in designing the tokenomics. I think this very human nature in the protocol design is often overlooked, and helps explain largely why the token burn exists.
I’d love to hear what people think, and if anyone disagrees. I haven’t been able to find anyone online who fundamentally breaks it down like this. With that said, let’s get to the more basic questions about gas.
What is gas?
Gas is the computational effort required to execute operations on the Ethereum network. It exists to prevent spammers, and also to prevent accidental infinite computational loops.
Since EIP 1559 in late 2021, gas is calculated as
units of gas used * (base fee + priority fee)
Simple ETH transfers cost 21,000 gas. Swaps cost more. The base and priority fees are quoted in gwei. Each gwei is equal to one-billionth of an ETH (0.000000001 ETH or 10-9 ETH).
Confusing? Here’s a good example from ethereum.org:
The total gas you pay is divided into two components: the base fee and the priority fee (tip).
The base fee is set by the protocol - you have to pay at least this amount for your transaction to be considered valid. The priority fee is a tip that you add to the base fee to make your transaction attractive to validators so that they choose it for inclusion in the next block.
A transaction that only pays the base fee is technically valid but unlikely to be included because it offers no incentive to the validators to choose it over any other transaction. The 'correct' priority fee is determined by the network usage at the time you send your transaction - if there is a lot of demand then you might have to set your priority fee higher, but when there is less demand you can pay less.
For example, let's say Jordan has to pay Taylor 1 ETH. An ETH transfer requires 21,000 units of gas, and the base fee is 10 gwei. Jordan includes a tip of 2 gwei.
The total fee would now be equal to:
units of gas used * (base fee + priority fee)
where the base fee is a value set by the protocol and the priority fee is a value set by the user as a tip to the validator.
i.e. 21,000 * (10 + 2) = 252,000 gwei (0.000252 ETH).
When Jordan sends the money, 1.000252 ETH will be deducted from Jordan's account. Taylor will be credited 1.0000 ETH. The validator receives the tip of 0.000042 ETH. The base fee of 0.00021 ETH is burned. - Source
How does the base fee work?
Each block has a target size of 15 million gas (the sum of all gas of transactions in the block). The limit is 30 million gas (2x the target).
If a block is 100% full the base fee increases by 12.5% in the next block; if it is 50% full (at the target size) the base fee will be the same; if it is 0% full the base fee would decrease by 12.5%. This works proportionally for any sized block.
This achieves a few things. First, it makes the base fee more predictable. Second, the exponential growth potential of the base fee makes it such that blocks revert towards the target of 15 million gas.
How much is burned?
“After the merge to Proof of Stake, Justin Drake's model estimates as a “best guess” that 1,000 ETH will be issued per day, and 6,000 ETH would be burned. Assuming more validators join and the staking APR is 6.7%, the annual supply change will be -1.6million ETH, reducing the annual supply rate by 1.4%.” - Source
Practically speaking…
Wallets like Metamask will automatically calculate the fee for you to get your transaction through, so for most people it’s not something to worry about. You have the option to adjust the base and priority fee, as well as gas limit yourself in advanced settings.
Monitor gas prices here: https://etherscan.io/gastracker
That’s all for now. I hope this was helpful in clarifying the role of gas and how it works in Ethereum!
Great explanation. Thank you very much.