# MEV

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

Source: https://learn.tradelabsai.com/crypto/mev/  
Track: Crypto · Level: Advanced · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "MEV", https://learn.tradelabsai.com/crypto/mev/

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](https://learn.tradelabsai.com/crypto/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

| 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](https://learn.tradelabsai.com/industry/front-running/) |
| Back running | Trade right after a large transaction to capture its price impact | Mostly neutral |

## How a sandwich attack works

**Example: A sandwiched swap**
You submit a swap to buy $50,000 of a token on a DEX with 2% slippage tolerance. A searcher sees your pending transaction and:

1. **Buys first,** pushing the price up 1.5%.
2. **Your trade executes** at the higher price, within your 2% tolerance, but you receive fewer tokens.
3. **The searcher sells right after,** at the even higher price your trade created.

You pay about $750 more than expected (1.5% of $50,000), and the searcher keeps most of it, minus gas and fees paid to the block builder. Setting a lower slippage tolerance limits how much a sandwich can take, but may cause your trade to fail in volatile markets. See [Slippage](https://learn.tradelabsai.com/markets/slippage/).

## 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](https://learn.tradelabsai.com/markets/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](https://learn.tradelabsai.com/algo-trading/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](https://learn.tradelabsai.com/crypto/mempools-and-gas/).

## Continue learning

- Next lesson: [Mempools and Gas](https://learn.tradelabsai.com/crypto/mempools-and-gas/)
- Previous lesson: [Oracles](https://learn.tradelabsai.com/crypto/oracles/)
- Related: [Oracles](https://learn.tradelabsai.com/crypto/oracles/): Oracles bring outside data like prices and event results onto blockchains. Learn how Chainlink feeds and UMA's optimistic oracle work, and how attacks happen.
- Related: [Mempools and Gas](https://learn.tradelabsai.com/crypto/mempools-and-gas/): Pending 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.
- Related: [Centralized vs Decentralized Exchanges](https://learn.tradelabsai.com/crypto/cex-vs-dex/): Centralised exchanges hold your funds and match orders; decentralised exchanges trade from your wallet via smart contracts. Compare costs, safety and how each works.
- Related: [Front-Running](https://learn.tradelabsai.com/industry/front-running/): Front running means trading ahead of a known pending order to profit from its impact. Learn the illegal and legal forms, crypto MEV and how to protect orders.
- Related: [DeFi Basics](https://learn.tradelabsai.com/crypto/defi-basics/): DeFi offers trading, lending and borrowing through smart contracts instead of banks. Learn the building blocks, where yields come from and the risks.
- Related: [Slippage](https://learn.tradelabsai.com/markets/slippage/): Slippage is the gap between the price you expect and the price you get. Learn what causes it, how to measure it and the practical ways to reduce slippage.
