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

  • You received noticeably less than the quote, close to your slippage limit.
  • On a block explorer, your swap sits between two trades of the same token by the same address, one just before and one just after.

How to avoid it

  • Keep slippage low. The more slippage you allow, the more a bot can take. Only raise it when a swap keeps failing.
  • Avoid tiny, illiquid pools for large amounts. Thin markets are easier to push around.
  • Use a swap that doesn't put your trade in the public queue. This is the strongest protection.
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.

Ready when you are

The panel opens set to this route. No account; you sign every step in your own wallet.

Swap ETH → USDC with MEV protection

Related

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