# MEV
The question this note answers: what happens when transaction ordering becomes a market?
MEV — maximal extractable value — is the value that can be captured by controlling which transactions get into a block, and in what order. To see why such value exists at all, walk through the canonical example.
## The canonical example
1. A user submits a swap: buy token X.
2. A searcher spots it sitting in the public mempool.
3. The searcher buys X first.
4. The user's trade executes, pushing the price up.
5. The searcher sells into the higher price.
This is a sandwich attack, and the user effectively paid a tax for being visible. Notice what made it possible: nothing exotic. Pending transactions are public, and execution is deterministic — so anyone can simulate the future and bid for the right to rearrange it.
If you come from databases, here's the framing that transfers: transaction ordering is normally a scheduler's internal detail that nobody profits from. Make the scheduler's choices public and auctionable, and an industry appears around influencing them. That's MEV.
## The extraction pipeline
And an industry did appear. What started as ad-hoc front-running has specialized into a supply chain:
```text
user -> mempool -> searchers find opportunities
-> builders assemble optimal blocks
-> proposers sell blockspace to the highest builder
```
Proposer-builder separation (PBS) is the protocol acknowledging that this market exists and trying to contain its centralizing pressure, rather than pretending it away.
## Responses
- Private mempools / order flow auctions
- Proposer-builder separation
- Encrypted mempools
- Batch auctions (everyone in a batch gets one clearing price)
- Fair-ordering protocols
It's worth noticing that none of these eliminate MEV. They redistribute who captures it, and how visibly — which is sometimes an improvement and always a tradeoff.
## Where this matters
- [[06 Transaction Lifecycle and MEV]] — the full path from signature to inclusion
- [[04 Consensus]] — proposers hold the ordering pen
- [[11 DeFi, Stablecoins, and Governance]] — AMMs and liquidations are the richest MEV sources
- [[12 Security and Incentive Design]] — MEV as an incentive-design problem