1. The Core Concept: The "God Mode" of Blockchains
To understand MEV, you first need to understand how a transaction works. When you trade on Ethereum, your transaction goes into a "waiting room" called the Mempool.
The people responsible for building the next block (formerly Miners, now Validators) pick transactions from this waiting room.
- The Power: Validators don't just pick transactions; they decide the exact order of them.
- The Profit: Because they control the order, they can insert their own transactions before or after yours to make a profit. This extra profit is called MEV.
Link to the next concept: How exactly does changing the order of transactions make money? Through specific Strategies.
2. The Strategies: The Sandwich Attack
MEV is essentially an invisible game played by bots. Here are the three main moves:
- Frontrunning: A bot sees you are about to buy a token (which will raise the price). The bot bribes the validator to let them buy it first at the cheap price.
- Backrunning: The bot sees a big trade happen that changes prices on an exchange. They immediately place a trade right after it to profit from the price difference (Arbitrage).
- The Sandwich Attack: This is the "toxic" combo.
- Alice tries to buy a token.
- Bot buys it before her (raising the price).
- Alice buys it at the inflated price.
- Bot sells it after her (locking in profit).
Result: Alice gets fewer tokens than she expected, and the bot steals the value.
Link to the next concept: In the early days, this process was incredibly messy and expensive. This was the PGA Era.
3. The Past: Priority Gas Auctions (PGA)
Before organized tools existed, MEV bots fought in public.
- The War: Two bots would see a profit opportunity. To beat each other, they would keep increasing the gas fee (transaction fee) they were willing to pay.
- The Damage: This "bidding war" happened on the public network. It clogged up Ethereum, making fees expensive for normal users who weren't even playing the game.
Link to the next concept: To save the network from being clogged by these wars, a solution was created: Flashbots.
4. The Fix: Flashbots and Hidden Channels
A group called Flashbots created a way to move these bidding wars off the main road.