SimpleSwapvsChangeNOW

MEV is the extra value that can be taken from a block by including, excluding or reordering transactions, and a sandwich attack is its most visible form for swappers

Maximal extractable value (MEV) is the value that can be extracted from block production beyond the block reward and gas fees, by including, excluding or reordering transactions (ethereum.org). Bots called searchers watch the public mempool for profitable trades. In a sandwich attack, a bot buys just before a large DEX swap and sells just after it, so the swapper gets a worse price.

Maximal extractable value (MEV)

The maximum value that can be extracted from block production beyond the standard block reward and gas fees, by including, excluding or reordering transactions in a block (ethereum.org).

How does a sandwich attack work?

  1. Spot

    A searcher watches the mempool for a large pending DEX trade.

  2. Front-run

    It places a buy just before the target trade, with a higher fee so it executes first.

  3. Victim fills

    The target trade executes at a worse price, inside its slippage tolerance.

  4. Back-run

    The searcher sells right after the target trade and keeps the difference.

Users who are sandwiched face increased slippage and worse execution (ethereum.org).

The slippage tolerance sets how far the attacker can push: if the price moves beyond it, the swap fails instead of filling (Uniswap docs).

What other kinds of MEV are there?

Front-running

  • A bot copies a profitable pending transaction.
  • It resubmits it with a higher gas price so it executes first.

DEX arbitrage

  • The simplest and best-known MEV opportunity.
  • Brings prices on different DEXs back in line.

Liquidations

  • Searchers race to liquidate undercollateralized loans.
  • They collect the protocol's liquidation fee.

Is MEV bad for regular users?

Myth

All MEV is theft.

Fact

Not all MEV is harmful: DEX arbitrage helps users get correct prices, and fast liquidations help lenders get repaid (ethereum.org).

Myth

Only whales get sandwiched.

Fact

Searchers look for trades where the profit beats their costs. A loose slippage tolerance makes a smaller trade attractive too.

Myth

A private relay is trustless.

Fact

Sending to a builder still involves trust that it will not front-run your transaction or leak it to searchers (Flashbots).

How do I protect my swap from front-running bots?

  • Keep slippage tolerance tight. It caps how much a sandwich can take. Too tight, and the swap may fail during normal price moves. More in Slippage.
  • Use a private transaction relay. Flashbots Protect sends transactions to a private mempool where they are hidden from front-running and sandwich bots, and includes them only if they do not revert, so you do not pay for failed transactions.
  • Split large orders. Price impact grows with size, and a large visible trade is the classic target.
  • 0gas paid for reverted transactions sent through Flashbots Protectdocs.flashbots.net
  • 2trades around the victim in a sandwich: one before, one afterledger.com

Does MEV affect instant swap services?

MEV happens around transactions that wait in a public mempool before execution, such as a DEX swap you sign yourself.

On an instant swap service you send a deposit and the service executes the order, so there is no slippage tolerance to set.

What protects the amount you receive there is the rate type: a fixed rate on SimpleSwap is locked for 20 minutes. More in Fixed vs floating rate.

Get a live quoteSimpleSwap ChangeNOW

Questions

What is MEV in crypto?

MEV, maximal extractable value, is the value that can be taken from block production beyond the block reward and gas fees, by including, excluding or reordering transactions.

What is a sandwich attack and how do I avoid it?

A bot buys just before a large DEX trade and sells just after it, so the victim gets a worse price.

A tight slippage tolerance limits the damage, and a private relay such as Flashbots Protect hides the transaction from sandwich bots.

What is Flashbots Protect and is it safe?

It sends your transaction to a private mempool instead of the public one, which hides it from front-running bots. You still trust the builder not to front-run or leak it.

Does a lower slippage tolerance protect against MEV?

It limits how far a sandwich can push the price. Set too low, the swap may fail during normal market moves.

Is MEV bad for regular users?

Some of it is. Sandwich attacks worsen execution for the victim. Other MEV, such as DEX arbitrage and liquidations, keeps prices aligned and lending markets solvent.