The Physics of Gas: EIP-1559 and Blob Markets
Why does a transaction cost $50? Understanding the algorithmic control theory behind EIP-1559 and the new multi-dimensional Blob Gas market.
🎯 What You'll Learn
- Analyze EIP-1559 as a PID Controller
- Calculate Base Fee volatility
- Differentiate Execution Gas vs. Blob Gas (EIP-4844)
- Implement fee estimation using `eth_feeHistory`
- Evaluate the economics of L2 Batch Posting
📚 Prerequisites
Before this lesson, you should understand:
Introduction
Gas is a “fee.” It is a Resource Pricing Mechanism for a constrained global computer.
The EVM can only process ~30 million gas per 12 seconds. When demand exceeds supply, the network must decide who gets in. Instead of a First-Come-First-Serve queue (which allows spam), Ethereum uses a Dynamic Pricing Algorithm (EIP-1559).
In this lesson, we break down the math of the Base Fee and the new “Blob Market” that powers Layer 2s.
The Control Theory: EIP-1559
Before EIP-1559, fees were a盲 auction. Now, fees are an Algorithmic Target.
The Algorithm
The protocol targets blocks that are 50% full (15M Gas).
- If utilization > 50%: Base Fee increases.
- If utilization < 50%: Base Fee decreases.
- Max Increase: 12.5% per block.
- Physics: If 10 blocks are full in a row, the price increases .
- Result: Spikes are smoothed out, but sustained demand becomes exponentially expensive.
The Burn
The Base Fee is destroyed. This couples the usage of the network to the scarcity of the asset (ETH). Pushing transactions burns the money supply.
4-Dimensional Gas: The Blob Market (EIP-4844)
In the Dencun upgrade (2024), Ethereum split into two fee markets.
- Execution Gas (Type 0/2 Transaction): Computation, Storage, Calldata. Expensive.
- Blob Gas (Type 3 Transaction): Ephemeral Data. Cheap.
Why Blobs?
Layer 2s (Arbitrum/Optimism) don’t need the EVM to execute their transaction data. They just need to store it so verifiers can check it later. Blobs are “Sidecars” attached to blocks. They persist for ~18 days and then are deleted.
The Physics:
- You now pay Priority Fee (Execution) + Blob Base Fee (Data).
- Blob Gas targets 3 blobs per block (Max 6).
- It has its own separate EIP-1559 update rule.
Code: Estimating Fees
You shouldn’t guess fees. You should ask the oracle (the previous blocks).
const { ethers } = require("ethers");
async function estimateFees(provider) {
// Get usage data from last 5 blocks
const history = await provider.send("eth_feeHistory", [5, "latest", [25, 50, 75]]);
const baseFee = BigInt(history.baseFeePerGas[4]); // Latest base fee
const priorityFees = history.reward[4]; // Tips from latest block
// Strategy: Base Fee * 1.5 (Buffer) + Median Tip
const maxBaseFee = (baseFee * 150n) / 100n;
const maxPriorityFee = BigInt(priorityFees[1]); // 50th percentile
return {
maxFeePerGas: maxBaseFee + maxPriorityFee,
maxPriorityFeePerGas: maxPriorityFee
};
}
Deep Dive: The L2 Economics
Layer 2s act as “Resellers” of gas.
- Wholesale: They buy Blob Space on L1.
- Retail: They sell L2 Gas to users.
Profit Margin = L2 Fees Collected - L1 Blob Rent. Since Blobs are extremely cheap (often < 1 gwei), L2 margins are currently high, and user fees are < $0.01.
Practice Exercises
Exercise 1: The Spike Calculation (Beginner)
Scenario: A popular NFT mint starts. Blocks are 100% full (30M gas). Task: Calculate how many blocks it takes for the Base Fee to go from 10 gwei to 100 gwei. (Hint: . Solve for ).
Exercise 2: Blob Cost (Intermediate)
Scenario: A blob is 128KB. Blob Base Fee is 10 gwei. ETH is $3000. Task: Calculate the cost to post 1MB of data to Ethereum.
Exercise 3: Multidimensional Pricing (Advanced)
Scenario: Execution Gas is cheap (10 gwei). Blob Gas is expensive (1000 gwei). Task: Explain what type of activity is happening on the network. (Hint: Is it DeFi trading or L2 posting?).
Knowledge Check
- What is the target block utilization?
- Why can transaction fees increase 10x in a few minutes?
- Does paying a higher Priority Fee lower your Base Fee?
- What happens to Blob Data after 18 days?
- Why do L2s use Blobs instead of Calldata?
Answers
- 50% (15 Million Gas).
- Exponential Update Rule. 12.5% compounding per block adds up fast.
- No. Base Fee is global protocol rule. Priority Fee is a local bribe to the validator.
- It is deleted from nodes. Only archive nodes behave to keep it. The protocol verification guarantee expires.
- Cost. Calldata competes with DeFi execution (expensive). Blobs compete only with other data (cheap).
Summary
- EIP-1559: Is a control loop balancing Supply and Demand.
- Blobs: Created a separate, cheaper lane for L2 data.
- The Future: Gas is becoming multidimensional. You pay for what you use (Compute vs Data).
Questions about this lesson? Working on related infrastructure?
Let's discuss