Sub topic 10
How Fee Markets Set the Price of Block Space
This chapter assumes you know what a blockchain transaction is, that blocks hold a limited number of transactions, and that you can read short Python snippets. It explains why a network fee changes from hour to hour, and why you can pay the same amount of money for very different service. The next two chapters apply the model to Bitcoin and to Ethereum-style chains.
Block space is a scarce good
A blockchain adds a new block at a roughly steady pace. Each block has a size limit. On Bitcoin the limit is measured in weight units. On EVM chains it is measured in gas. In both cases the limit is a ceiling on how much work the network will accept per block.
Block space is the room inside those blocks. Because supply per block is fixed by protocol rules, it cannot grow when more people want to transact. A fee market is the mechanism that decides who gets that room when demand exceeds supply.
Two facts shape everything that follows:
- Supply is close to inelastic in the short run. A busy hour does not create more room.
- Demand is uneven. A popular token launch, a market crash, or a liquidation wave can send thousands of users to the same blocks at once.
When demand is below capacity, almost any fee gets your transaction included, so the fee falls toward the minimum the network allows. When demand is above capacity, a queue forms and users bid against each other for a place in it.
The mempool: where bids wait
A transaction you broadcast does not go straight into a block. It first sits in the mempool, the pool of valid transactions that nodes have heard about and that are waiting for inclusion. Each node keeps its own mempool, so two nodes can see slightly different queues.
A block producer (a miner or validator) chooses which waiting transactions to include. Producers want to earn as much as they can from each block, so they normally pick the transactions that pay the most per unit of block space.
The key point is the unit: producers compare fee per unit of space, not the total fee. A large transaction paying a large total can still lose to a small one that pays more per unit, because the large one uses up more of the scarce room.
Two ways to price the same scarcity
Networks have used two main designs. Both are auctions for the same limited room.
First-price auction
In a first-price auction you state a price, and if you win, you pay exactly what you stated. Early Ethereum worked this way, and Bitcoin still does. The weakness is guessing. If you bid too low you wait. If you bid too high you overpay, and you cannot know the right amount in advance because other people's bids are hidden until the block appears.
Base fee plus tip
Ethereum changed its design with EIP-1559. Each block has a protocol-set base fee that every transaction must pay. The base fee is burned, which means it is destroyed and does not go to the producer. On top of it, you can add a priority fee, a tip that goes to the producer and persuades them to include you sooner.
The protocol moves the base fee up and down by itself, using the previous block's fullness as the signal:
- If the last block was more than its target size, the base fee rises, by at most 12.5% per block.
- If it was less than the target, the base fee falls by up to the same amount.
- If it was exactly at target, the base fee stays the same.
This makes the fee a price that responds to demand, not a blind bid. Most of the guessing moves into one small variable, the tip.
| Property | First-price auction | Base fee plus tip |
|---|---|---|
| What you pay | Exactly your bid | Base fee plus tip, up to your cap |
| Main difficulty | Guessing the winning bid | Choosing the tip, and a cap that survives rising base fees |
| Risk of overpaying | High when you bid defensively | Lower, because unused cap is refunded |
| Who receives the fee | Producer | Base fee burned, tip to producer |
Why fees spike
Fees rise sharply during busy periods because small changes in demand have large effects on the price when supply cannot move. Think of a theater with 1,000 seats. If 900 people want tickets, any ticket sells for the face price. If 1,500 want them, the last 500 buyers must outbid each other, and the winning price is set by the person who values the final seat the least among those who get in.
The same logic applies to blocks. The fee you must pay to be included is set at the margin: just above the bid of the highest-paying transaction that got left out.
Three situations commonly push demand up together:
- Sharp price moves. Traders move coins to or from exchanges and close leveraged positions.
- Popular launches. Many users try to claim or mint something in the first blocks.
- Congested periods that last. Unconfirmed transactions pile up, and each new block clears only part of the backlog.
Estimating a good fee
Wallets estimate fees by looking at the mempool and recent blocks. A simple version of that idea is below. Given recent fee rates paid by included transactions, it picks a percentile to aim for. A higher percentile means faster confirmation and a higher cost.
def percentile(values, pct):
ordered = sorted(values)
index = round((len(ordered) - 1) * pct / 100)
return ordered[index]
# Fee rates (any consistent unit) paid by recently confirmed transactions.
recent = [4, 5, 5, 6, 6, 7, 8, 9, 12, 15, 22, 40]
slow = percentile(recent, 25)
normal = percentile(recent, 50)
fast = percentile(recent, 90)
print(slow, normal, fast)This prints 6 8 22. The spread between slow and fast shows how much a rush costs. It also shows the limit of the method: past fees describe the previous blocks, and demand can change before your transaction is mined.
Failure modes and edge cases
- Stuck transactions. If you pay too little during a spike, your transaction can wait for hours or be dropped from nodes' mempools. Many wallets let you replace it with a higher-fee version of the same transaction, or on Bitcoin, pay for a child transaction that lifts the pair.
- Overpaying by habit. Using a fixed high fee setting is safe but costly when the network is quiet.
- Estimate lag. Fee estimators see the past. A sudden surge can make a "normal" estimate too low.
- Different mempools. Nodes disagree slightly, so one wallet's estimate can differ from another's.
- Cap too tight. On base-fee chains, if your maximum fee is below the rising base fee, your transaction cannot be included until the base fee falls back.
- Fee does not depend on value. Sending 10 dollars costs the same as sending 10 million dollars, because the fee pays for space used, not for the amount moved.
Connecting back to total cost
Network fees are one of three cost layers in a crypto trade. They matter most when you move coins on-chain, such as depositing to or withdrawing from an exchange. Because the price swings with demand, the same withdrawal can cost very different amounts a day apart. The next chapters show how that price is turned into a number for Bitcoin and for EVM chains, and a later chapter explains why an exchange's withdrawal fee may not match what the network charged.
Exercise
Two Bitcoin-style transactions wait in the mempool. Transaction A is 500 virtual bytes and pays a total of 5,000 satoshis. Transaction B is 200 virtual bytes and pays a total of 3,000 satoshis. A block producer has room for only one. Which does a fee-per-unit-of-space producer choose, and why?
Show answer
Transaction B. Its fee rate is 3,000 / 200 = 15 satoshis per virtual byte, while A pays 5,000 / 500 = 10. Producers rank by fee per unit of space, so B earns more per unit of scarce room even though A pays a larger total.
Exercise
On an EIP-1559 chain, the base fee is 40 gwei and the last block was full at twice its target size. Roughly what is the next block's base fee, and why might a transaction with a maximum fee of 42 gwei fail to get included?
Show answer
The base fee rises by the maximum 12.5%, so it becomes about 40 x 1.125 = 45 gwei. A transaction capped at 42 gwei cannot cover the base fee, so it cannot be included until the base fee falls back below its cap.