DeFi

What Is MEV in Crypto? Sandwich Attacks, Frontrunning and How to Protect Yourself

Maximal Extractable Value — MEV — is one of the least understood but most impactful forces operating in crypto markets today. Every time you swap on a DEX, MEV bots are watching your transaction before it confirms, and some of them are designed to profit at your direct expense.

Blog DeFi What Is MEV in Crypto? Sandwich Attacks, Frontrunning and How to Protect Yourself
May 24, 2026
Updated May 24, 2026
0 comments

What Is MEV (Maximal Extractable Value)?

MEV — originally Miner Extractable Value, now Maximal Extractable Value — refers to the profit that can be extracted from a blockchain by reordering, including, or excluding transactions within a block. Whoever has the power to sequence transactions (historically miners, now validators in proof-of-stake systems) can manipulate this ordering to capture value above and beyond standard block rewards and fees.

MEV is not a bug. It is an emergent property of how public blockchains work: all pending transactions are visible to everyone before they are confirmed, and whoever controls transaction ordering can exploit that visibility for profit. The concept was formally described in the 2019 research paper "Flash Boys 2.0," which documented how Ethereum's transparent mempool created a competitive environment for bots to extract profit from ordinary users.

How Sandwich Attacks Work: Step by Step

The sandwich attack is the most costly form of MEV for retail DeFi users. Here is exactly how it works:

  1. You submit a swap: You send a transaction to swap 1 ETH for USDC on Uniswap. Your transaction enters the public mempool with a 1% slippage tolerance.
  2. The bot spots your transaction: An MEV bot scans the mempool in real time. It sees your swap, calculates how much it will move the price, and notes your slippage tolerance. It decides your transaction is profitable to sandwich.
  3. Frontrun: The bot submits a transaction to buy the same asset — paying higher gas to jump ahead of you. This purchase moves the price upward before your trade executes.
  4. Your transaction executes at a worse price: Your swap now executes at the elevated price. You still complete your trade, but receive fewer USDC — potentially up to your full 1% slippage tolerance.
  5. Backrun: Immediately after your transaction, the bot sells what it bought back into the pool. Your transaction moved the price back, and the bot pockets the spread.

On small trades, the loss is barely noticeable. On large swaps with high slippage tolerance, the extraction can reach hundreds or thousands of dollars on a single transaction.

Other Forms of MEV

  • Pure arbitrage: Bots spot price discrepancies between DEX pools and execute trades to close the gap. Generally considered "good" MEV — it improves price efficiency and does not directly harm individual users.
  • Liquidation MEV: When collateralized loan positions fall below their liquidation threshold on Aave or Compound, bots race to submit the liquidation and capture the bonus. This keeps protocols solvent but can be harmful if bots manipulate oracle prices to trigger artificial liquidations.
  • Time-bandit attacks: A theoretical (and expensive) form where validators reorganize recent blocks to capture MEV from already-confirmed transactions. Rare in practice but represents a systemic risk.

How Big Is MEV?

MEV extraction has become a professionalized industry. Sophisticated searchers — individuals and firms running custom bots — compete to identify and capture MEV. They submit transaction bundles to block builders who optimize MEV extraction. According to Flashbots and independent researchers, cumulative MEV extracted on Ethereum alone has exceeded $1 billion, with hundreds of millions extracted annually. In bull markets with high DeFi activity, daily MEV reaches millions of dollars — all taken directly from ordinary users' transaction quality.

How to Protect Yourself from MEV

  • Use a private RPC endpoint: By default, your transactions broadcast to the public mempool where any bot can see them. Switching to a private RPC — Flashbots Protect, MEV Blocker, or Merkle — routes transactions directly to validators without public mempool exposure. This is the single most effective protection against sandwich attacks and takes two minutes to set up in MetaMask.
  • Set tight slippage tolerances: Lower slippage means less profitable sandwich targets. If an attack would push price past your tolerance, your transaction fails rather than executing at a worse price. For stable-to-stable swaps, use 0.1%. For volatile assets, use the minimum that allows the trade to succeed.
  • Use MEV-resistant DEX aggregators: CoW Protocol batches trades and executes off-chain through auctions that eliminate frontrunning. 1inch Fusion mode routes orders through resolvers that avoid public mempool exposure for larger trades.
  • Break large swaps into smaller transactions: Reducing individual trade size decreases your price impact and attractiveness as an MEV target.
  • Trade on CEXs for very large amounts: Centralized exchange order matching is not subject to blockchain MEV. For large trades, a CEX may offer better effective execution even accounting for withdrawal fees.

Does MEV Matter If You Avoid DeFi?

If you exclusively use centralized exchanges and never interact with DeFi protocols, MEV does not affect your personal transactions. You cannot be sandwiched on Binance because their order books are not public mempools. However, MEV indirectly affects all crypto participants through market structure — arbitrage bots that extract MEV also ensure price consistency across DEX pools, keeping DeFi liquidity functional. Switching to a private RPC costs nothing and eliminates the most harmful MEV exposure for any DeFi user.

0 Comments

No comments yet — be the first to share your thoughts.

Leave a Comment

Your email won't be published. After submitting, you'll receive a quick verification email — click the link to publish your comment.

Used only to verify your comment — never shown publicly.

0 / 2000

Free Newsletter

Get weekly crypto trading insights

New guides, tool updates, and market analysis — straight to your inbox. No spam, unsubscribe anytime.