MEV
MEV is value extracted by reordering or inserting blockchain transactions. Learn sandwich attacks, arbitrage and liquidation MEV, and how to protect trades.
MEV, short for maximal extractable value (originally miner extractable value), is the profit that can be made by choosing which transactions go into a block and in what order. On public blockchains like Ethereum, pending transactions are visible before they are confirmed, so specialised bots can see a large trade coming and position around it. Some MEV is useful, such as arbitrage that keeps prices aligned across exchanges; some, like sandwich attacks, directly costs ordinary users. Researchers estimate that hundreds of millions of dollars of MEV have been extracted on Ethereum.
Why MEV exists#
- Users broadcast transactions to the network, where they wait in the mempool. See Mempools and Gas.
- Searchers (bots) scan the mempool for profitable opportunities.
- Block builders assemble blocks, ordering transactions to maximise value.
- Validators (or miners on proof of work chains) choose which block to propose.
Because the order of transactions affects prices on decentralised exchanges, whoever controls ordering can capture value.
Types of MEV#
| Type | What happens | Effect on users |
|---|---|---|
| Arbitrage | Buy on one DEX and sell on another where the price is higher | Mostly neutral; aligns prices |
| Liquidations | Race to liquidate undercollateralised DeFi loans for a bonus | Neutral to the system; keeps protocols solvent |
| Sandwich attacks | Buy just before a user's swap and sell just after | Harmful: user gets a worse price |
| Front running | Copy or jump ahead of a profitable transaction | Harmful to the original sender. See Front-Running |
| Back running | Trade right after a large transaction to capture its price impact | Mostly neutral |
How a sandwich attack works#
Proposer builder separation and MEV infrastructure#
On Ethereum, much block building is outsourced through systems like MEV Boost: specialised builders compete to create the most valuable blocks, and validators choose the highest bid. Flashbots, a research organisation, introduced private transaction channels to reduce harmful MEV and make extraction more transparent. These systems changed how MEV is captured but did not eliminate it.
How to protect yourself#
- Use private transaction relays or "protected" RPC endpoints that send trades directly to builders rather than the public mempool.
- Set tight slippage limits on DEX trades.
- Split large trades or use limit orders and aggregators with MEV protection.
- Trade in deep pools, where price impact is smaller. See Liquidity.
- Use batch auction or intent based platforms designed to resist sandwiching.
MEV and traditional markets#
MEV resembles practices in traditional markets, such as front running by brokers (illegal) and latency arbitrage by high frequency traders (legal). The difference is that on public blockchains, transaction ordering is open and anyone with the right tools can participate. See High-Frequency Trading.
Beyond Ethereum#
MEV exists on most smart contract chains, including Solana, BNB Chain and layer 2 networks, though mechanisms differ. Some layer 2s use centralised sequencers that order transactions, which shifts MEV questions to how fairly the sequencer behaves.
Frequently asked questions#
What is MEV in crypto?#
Maximal extractable value: profit captured by including, excluding or reordering transactions within a block.
What is a sandwich attack?#
An attack where a bot buys before a user's swap and sells right after, profiting from the price impact and giving the user a worse price.
How can I avoid MEV?#
Use private transaction relays or MEV protected endpoints, set low slippage tolerance and trade in deep liquidity pools.
Next, learn how transactions wait and pay to be included in Mempools and Gas.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- OraclesCrypto
- Staking and RestakingCrypto
- Crypto and Prediction Markets Learning PathStart Here