MEV (Maximal Extractable Value) is the profit that block producers (validators/miners) or specialized searchers can extract by reordering, inserting, or censoring transactions within a block. It includes front-running trades, sandwich attacks, and arbitrage, all made possible because block producers choose the order in which transactions execute.

What Is MEV?

3 min read

The short version

MEV is what happens when the person in charge of ordering transactions can peek at everyone's pending trades and profit from that knowledge. If they see you are about to buy a token and push the price up, they can buy first (front-run), let your trade push the price up, then sell immediately after (back-run). Your trade still executes, but at a worse price, and the MEV extractor pockets the difference.

How It Works

When you submit a transaction, it enters the public mempool where anyone can see it. MEV searchers run bots that: (1) Monitor the mempool for profitable opportunities. (2) Construct transactions that extract value (buying before your large swap, arbitraging price differences created by your swap, liquidating underwater positions). (3) Submit bundles to block builders (via Flashbots or similar) with priority fees that guarantee ordering. On Ethereum post-Merge: validators use MEV-Boost to outsource block construction to specialized builders, who compete to build the most valuable block (including MEV). The validator gets a portion of the MEV profit as a bid from the builder. Common MEV types: front-running (buying before you), back-running (arbitraging after you), sandwich attacks (front-run + back-run together), liquidation MEV (detecting liquidatable positions first), and JIT (Just-In-Time) liquidity.

A sandwich attack on your Uniswap swap

You submit a swap: buy $10,000 of TOKEN with USDC, with 1% slippage tolerance. A sandwich bot sees your pending transaction. It constructs: (1) Front-run, buy TOKEN just before you (pushing price up 0.4%). (2) Your swap executes at the slightly higher price (you pay $10,040 instead of $10,000, within your 1% slippage). (3) Back-run, bot sells TOKEN immediately after (at the price your buying pushed it to). Bot profit: ~$30-$50 minus gas. Your loss: you received slightly less TOKEN than you would have without the sandwich. Protection: use DEX aggregators with MEV protection (CoW Swap, 1inch Fusion), reduce slippage tolerance, or use private transaction pools (Flashbots Protect).

What People Get Wrong

  • MEV only affects large traders

    Sandwich attacks target any swap with detectable slippage. Even a $500 swap can be sandwiched if the profit exceeds gas costs. On L2s where gas is cheap, even very small swaps are targets.

  • MEV is illegal

    MEV exists in a legal gray area. Front-running in traditional securities markets is illegal. In permissionless DeFi, there is no clear legal prohibition because anyone can order transactions. The ethics are debated, but enforcement is practically non-existent.

  • You can avoid MEV by using a different DEX

    MEV depends on transaction ordering visibility, not the DEX itself. However, DEXs with built-in MEV protection (CoW Swap's batch auctions, private order flow) genuinely reduce MEV extraction from your trades.

  • Validators are the ones extracting MEV

    Post-PBS (Proposer-Builder Separation), MEV is primarily extracted by searchers (who find opportunities) and builders (who construct optimal blocks). Validators receive bids from builders and select the highest-value block, they benefit from MEV but rarely extract it directly.

Sources & Further Reading

  • Flashbots Docs

    Documentation for Flashbots MEV infrastructure: Protect, MEV-Boost, MEV-Share

  • MEV Blocker

    Free RPC endpoint that protects your transactions from sandwich attacks

  • EigenPhi MEV Dashboard

    Real-time MEV activity monitoring across Ethereum and L2s

Questions People Also Ask

How much MEV is extracted daily?
On Ethereum mainnet, MEV extraction varies from $1M-$10M+ per day depending on market activity. Cumulative extracted MEV since 2020 exceeds $600M. L2s have growing MEV activity as their volume increases.
How can I protect myself from MEV?
Use MEV-protected RPC endpoints (Flashbots Protect, MEV Blocker), DEXs with batch auctions (CoW Swap), limit orders instead of market swaps, and tight slippage settings. On L2s: use sequencer-private transaction pools where available.
Is MEV a problem or a feature?
Both. Arbitrage MEV (equalizing prices across DEXs) improves market efficiency. Sandwich attacks extract value from users and are parasitic. The Ethereum community is working on solutions (encrypted mempools, PBS improvements) to minimize harmful MEV while preserving beneficial arbitrage.

More in Smart Contracts & Ethereum

See all →
Was this page helpful?

Page last checked