What is a sandwich attack (MEV), and how do you avoid it?

You swap $1,000 of ETH for USDC and receive a little less than the quote said. Often that's no accident. Bots watch for swaps like yours and squeeze value out of them. This is called a sandwich attack, one form of MEV.

How a sandwich attack works

  1. You send a swap. Before it is included in a block, it waits in a public queue where anyone can see it.
  2. A bot sees your swap and the slippage you allowed, for example “up to 1% worse than quoted”.
  3. The bot buys the same token just before you, pushing the price up.
  4. Your swap goes through at that worse price, still inside your slippage limit, so it doesn't fail.
  5. The bot sells right after you and keeps the difference.

Your trade is the filling in the bot's sandwich. You paid more, and the bot earned exactly what you lost.

What MEV means

MEV stands for “maximal extractable value”: profit someone can make by choosing the order of transactions in a block. Sandwich attacks are the kind that hurt ordinary traders most directly.

How to tell if it happened to you

How to avoid it

How the swap page protects you. Swaps on this site run on CoW Protocol. You sign an order instead of sending a public swap transaction. Orders are collected into short batches and settled together at one price for everyone in the batch, by competing “solvers”. With no public pending swap to target and no advantage in being first in line, a sandwich has nothing to work with.

Bonus: matched trades

When two people in the same batch want opposite trades (one sells ETH for USDC, another buys ETH with USDC), CoW Protocol can match them directly. That's called a “coincidence of wants”, and it skips the pool and its fees entirely for the matched part.

Open the swap page

Nothing here is financial advice. Crypto transactions cannot be reversed.