Typefully

Ethereum Gas and EIP-1559 Gas Markets

Avatar

Share

 • 

A year ago

 • 

View on X

(1/23) @ethereum Gas and Gas Markets (EIP-1559) Gas is the mechanism by which (most) blockchains manage computational resources and drive revenue to node operators. Let's dive deep on blockchain fees and the gas market that underpin Ethereum.
(2/23) @ethereum is the World Computer, a single, globally shared computing platform that exists in the space between a network of 1,000s of computers (nodes). These nodes are real computers in the real world, communicating directly from peer to peer. x.com/LogarithmicRex/status/1592309373732151296
(3/23) Computation on the World Computer is a globally shared, scare resource. Ethereum must limit the amount of computation possible within a single block in order to maintain decentralization. Gas is how we divide up the computational units of the EVM; $ETH is how we price it. x.com/LogarithmicRex/status/1858674708633579806
(4/23) While the thread linked in the tweet above gives you a good understand of what gas is, what is conspicuously absent is any discussion on the market dynamics of gas. So let's dive in. The Ethereum gas market needs to be split into two eras: before EIP-1559 and after.
(5/23) We'll get to EIP-1559 shortly, but it's worth spending a few moments thinking about how Ethereum worked from genesis (July 2015) until the hard-fork that brought us EIP-1559 (August 2021). During this first era, while Ethereum gas was simple, it was problematic.
(6/23) Pre EIP-1559, when a user wanted to make a transaction, they would specify the price per gas they were willing to pay. As this fee was paid directly to the miner (block proposer), who would select txns with the highest gas prices and incorporate them into blocks first.
(7/23) Because users were bidding against each other, gas prices were very unpredictable and fluctuated wildly. Users had to guess how much to pay, risking overpaying or setting a fee too low. Not only did this lead to incredible volatility, it was just a poor experience.
(8/23) Which brings us to EIP-1559! Delivered via the London hard fork in August 2021, EIP reshaped how Ethereum gas works. Here is a link to the official specs of the upgrade, but don't worry, we are about to walk through the big changes. eips.ethereum.org/EIPS/eip-1559
(9/23) The most important change that EIP-1559 brought was a restructuring of the gas market. Remember: previously the market was a first-price auction (aka a blind auction). All of the fees were paid directly to the miner. EIP-1559 created a dual-fee system.
(10/23) Here's how the dual-fee model works: Base Fee: a mandatory fee, set directly by the EVM based on current market demand. All base fees are burned. Priority Fee: an optional tip users can add to incentivize block proposers. All priority fees are paid to the proposer.
(11/23) Remember how we mentioned that the pre-EIP-1559 was problematic because it was extremely unpredictable (especially when there was lots of congestion/high demand for the EVM)? The base fee fixes this by providing a transparent, algorithmically determined price.
(12/23) If a block is more than 50% full, Ethereum will increase the base fee for the next block. If the block is less than 50% full, Ethereum will decrease the base fee for the next block. This allows Ethereum to price its computational resources based on real-time demand.
(13/23) Pre-EIP-1559, we talked about how the entire gas fee was given to the miner/block proposer. Under EIP-1559, the base fee doesn't go to the miner/proposer; instead it is "burnt." Burning permanently removes it from circulation. Once burnt, it can never be recovered.
(14/23) Understanding the full implication of burning the base fee is a little out of scope for this thread. Suffice to say that the purpose of the burn is to make $ETH deflationary (increasing the unit price of $ETH) in times of high demand.
(15/23) Let's pause and summarize: the first major change of EIP-1559 was introducing the base fee. The base fee is set by Ethereum based on the current demand for block space. The base fee is always burned, removing that $ETH from circulation.
(16/23) Fun fact: before EIP-1559, there was nothing within the protocol that forced gas fees to be paid in $ETH - it was just custom. A user could offer a miner/proposer $USDC (or even something off-chain). The base fee changed that and formally bound $ETH to Ethereum.
(17/23) Just like EIP-1559 created the base fee, it also created the priority fee. The priority fee is very similar to the entire pre-EIP-1559 gas market. Its purpose is to incentivize proposers to include transactions and is paid entirely to them.
(18/23) Increasing the amount you’re willing to pay for the priority fee makes it more likely that a proposer will include your txn. This gives users the flexibility to pay more for faster inclusion and ensures proposers continue to receive compensation (despite the burn).
(19/23) The last change that EIP-1559 introduced was elastic block sizes. This allows the gas limit of the next block fluctuate based on market demand. If there is more demand, the blocks can grow bigger to accommodate.
(20/23) Before EIP-1559, the gas limit was set slowly over time by the block proposers. Each block proposer could adjust the limit by a very small percentage (~.1% per block). This is how we grew from a gas limit of 5k (genesis) to ~15MM (at the time of the switch to EIP-1559).
(21/23) The EIP-1559 system set the target gas limit to 15MM gas. When the network is congested, blocks can expand up to 2x (30MM gas). When congestion dies down, Ethereum gradually reduces the gas limit until they once again reach the target gas limit.
(22/23) This gives Ethereum the flexibility to surge resources when demand is high without committing to unbounded growth. And remember, keeping the size of blocks under control is the key to maintaining decentralization and, through it, credible neutrality.
(23/23) So here are your main takeaways: EIP-1559 introduced the base fee (making gas more predictable and responsive to demand and introducing the burn), the priority fee (tips to incentivize inclusion) and dynamic block sizes (to surge resources in times of high demand).
Avatar

Logarithmic Rex

@LogarithmicRex