Skip to content

Deep dive · Mechanisms & Tech · 8 min

MEV: Invisible Extraction on Ethereum

Flashbots, sandwich attacks, priority gas auctions — how bots make money off your transaction before it even confirms.

On this page
Why this matters

(Maximal Extractable Value, formerly “Miner Extractable Value”) is the value that can be extracted from the ordering of transactions in a block — by front-running, back-running, sandwiching, or arbitraging user transactions. On Ethereum, MEV extraction is a multi-billion-dollar invisible economy that most users never see but pay for through worse prices. Understanding MEV is understanding a hidden layer of crypto markets that affects every transaction you make on a DEX.

Standard Explanation

MEV is the value that block producers (miners in PoW, validators in PoS) — or specialized “searchers” who pay block producers — can extract by ordering, including, excluding, or censoring transactions within a block. Because block producers choose which transactions go in a block and in what order, they can front-run user transactions, back-run them, or insert arbitrage transactions that capture value from users' trades.

The origin: Flash Boys 2.0

MEV was formally identified in a 2019 paper by Philip Daian and colleagues at Cornell, titled “Flash Boys 2.0”. The paper documented how bots on Ethereum were front-running decentralized exchange trades, running “priority gas auctions” (bidding up gas fees to get their transaction ordered first), and extracting value from users in ways that were invisible to the users themselves. The name “Flash Boys 2.0” was a reference to Michael Lewis's “Flash Boys” about high-frequency front-running in traditional markets — the crypto version was, if anything, worse, because the mempool was public and anyone could see pending transactions before they were processed.

The types of MEV

Sandwich attacks

The most user-harmful form. A bot sees your large swap on a DEX (e.g., buying ETH with USDC) in the mempool. The bot:

  1. Buys ETH before your transaction (front-run), pushing the price up.
  2. Your transaction executes at the higher price (you get less ETH than you would have).
  3. The bot sells ETH after your transaction (back-run), pocketing the difference.

You've been “sandwiched” — the bot is the bread, you're the filling. The bot profits; you get a worse price. This happens thousands of times per day on Ethereum.

Arbitrage

A bot sees that ETH is priced differently on two DEXes (e.g., $3,000 on Uniswap, $3,005 on Sushiswap). The bot buys on Uniswap and sells on Sushiswap in the same block, pocketing $5 per ETH. This is not harmful to users — it's actually beneficial, because it keeps prices in sync across exchanges. Arbitrage is the “good” kind of MEV.

Liquidations

On a lending protocol (Aave, Compound), if a borrower's collateral falls below the required ratio, their position can be liquidated. Bots compete to be the first to liquidate (and earn the liquidation bonus). This is a form of MEV — the bot extracts value from the liquidation. It's arguably beneficial (it keeps the protocol solvent) but the speed competition can lead to gas price spikes.

Priority gas auctions (PGA)

When multiple bots compete for the same opportunity (e.g., the same arbitrage), they bid up gas prices to get their transaction ordered first. This “gas war” can push gas prices to extreme levels — and the value is burned (on Ethereum post-EIP-1559) or paid to the block producer. PGAs are a form of MEV that extracts value from bots, but the collateral damage (higher gas prices for everyone) affects users.

The Flashbots solution

In 2020, a research and development organization called proposed a solution to the worst excesses of MEV. The problem they identified was that MEV extraction via priority gas auctions was causing network congestion (bots spamming transactions to compete) and centralizing block production (the miner/validator who extracted the most MEV had the highest revenue and could outcompete others).

Flashbots created a sealed-bid auction for transaction ordering. Instead of bots spamming the public mempool and bidding up gas prices, searchers submit “bundles” of transactions with a bid to a private relay. Block producers (miners/validators) choose the most profitable bundles and include them directly — without the transactions ever appearing in the public mempool. This:

  • Eliminated the congestion from priority gas auctions.
  • Gave users a way to avoid sandwich attacks (by routing transactions through private relays that don't front-run).
  • Made MEV extraction more efficient and less harmful.

Proposer-Builder Separation (PBS)

Flashbots' work evolved into Proposer-Builder Separation (PBS) — a proposed architectural change where the roles of building a block (choosing and ordering transactions) and proposing a block (committing it to the chain) are separated. Block builders (specialized entities) compete to build the most profitable block and submit it to the proposer (validator), who picks the highest-bidding block. This:

  • Reduces the centralization pressure on validators (they don't need to extract MEV themselves — they just pick the best bid).
  • Creates a competitive market for block building.
  • Makes MEV extraction more transparent and democratized.

PBS is partially implemented via MEV-Boost (the Flashbots relay software used by most Ethereum validators post-Merge). Full enshrined PBS is part of Ethereum's long-term roadmap.

Is MEV good or bad?

MEV is a complex topic with no simple answer. Some forms (arbitrage, liquidations) are beneficial — they keep markets efficient and protocols solvent. Other forms (sandwich attacks, censorship) are harmful — they extract value from users without providing any service. The debate is not about eliminating MEV (which is probably impossible in a permissionless system) but about mitigating the harmful forms while allowing the beneficial ones. Flashbots, PBS, and encrypted mempools are all attempts to do this. The honest assessment: MEV is a tax on users that funds infrastructure. The question is whether that tax is fair and transparent.

How to protect yourself

  • Use a router with MEV protection. Many DEX aggregators (1inch, Matcha, CoWSwap) route transactions through private relays or use batch auctions that prevent sandwich attacks.
  • Slippage settings. Set a realistic slippage tolerance. Too high = you get sandwiched. Too low = your transaction reverts. 0.5–1% is a common range for most swaps.
  • Split large trades. A single huge swap is a sandwich magnet. Splitting it into smaller transactions (or using a TWAP service) reduces visibility and impact.
  • Use private mempools. Services like Flashbots Protect route your transaction directly to a builder, bypassing the public mempool where sandwich bots lurk. (Trade-off: your transaction may take longer to include.)

Key takeaways

  • MEV (Maximal Extractable Value) is the value extracted from the ordering of transactions in a block — front-running, back-running, sandwiching, and arbitraging user transactions. It was formally identified in the 2019 “Flash Boys 2.0” paper.
  • The most harmful form is the sandwich attack: a bot front-runs your swap (pushing the price up), your swap executes at the worse price, then the bot back-runs (selling for a profit). You get a worse price; the bot profits.
  • Some MEV is beneficial: arbitrage keeps prices in sync across DEXes; liquidations keep lending protocols solvent. The debate is about mitigating harmful MEV (sandwich attacks, censorship) while allowing beneficial MEV.
  • Flashbots created a sealed-bid auction for transaction ordering (reducing congestion and sandwich attacks) and pioneered Proposer-Builder Separation (PBS), now partially implemented via MEV-Boost on most Ethereum validators.
  • Users can protect themselves with MEV-aware routers, realistic slippage settings, splitting large trades, and private mempools (Flashbots Protect). MEV is an invisible tax — the goal is to minimize the part you pay.
Educational only, not financial or legal advice.