TradeLabs AILearn

MEV

MEV is value extracted by reordering or inserting blockchain transactions. Learn sandwich attacks, arbitrage and liquidation MEV, and how to protect trades.

Advanced3 min readUpdated 3 Oct 2026
Markdown
Read firstOracles
Lesson 19 of 24

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#

  1. Users broadcast transactions to the network, where they wait in the mempool. See Mempools and Gas.
  2. Searchers (bots) scan the mempool for profitable opportunities.
  3. Block builders assemble blocks, ordering transactions to maximise value.
  4. 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#

TypeWhat happensEffect on users
ArbitrageBuy on one DEX and sell on another where the price is higherMostly neutral; aligns prices
LiquidationsRace to liquidate undercollateralised DeFi loans for a bonusNeutral to the system; keeps protocols solvent
Sandwich attacksBuy just before a user's swap and sell just afterHarmful: user gets a worse price
Front runningCopy or jump ahead of a profitable transactionHarmful to the original sender. See Front-Running
Back runningTrade right after a large transaction to capture its price impactMostly 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#

  1. Use private transaction relays or "protected" RPC endpoints that send trades directly to builders rather than the public mempool.
  2. Set tight slippage limits on DEX trades.
  3. Split large trades or use limit orders and aggregators with MEV protection.
  4. Trade in deep pools, where price impact is smaller. See Liquidity.
  5. 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.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonMempools and GasPending crypto transactions wait in the mempool and pay fees to be included. Learn how Bitcoin fees and Ethereum gas work, EIP 1559 and how to avoid overpaying.

Mentioned in