DeCrypto Markets

Advanced tier

MEV Sandwich

MEV Sandwich is a game about sandwich attacks, one form of MEV. You see a pending swap the way a bot does: its size, its slippage tolerance and its minimum received. You set the bot's front-run: the largest buy before the swap that still lets it fill. Too-tight swaps are not worth the gas: skip them.

Create a free account to play

Free, with a verified email address. An account saves your progress, and floors and tiers open as you level up.

What it teaches

How sandwich attacks profit from loose swap settings.

  • How a sandwich attack works: buy before the victim, let the victim push the price, sell after.
  • Why the minimum received is the bot's only limit, and why it takes nearly all of that room.
  • Why tight tolerances, smaller swaps and deeper pools leave a bot nothing worth the gas.

How a round plays

  1. A swap is waiting in the public queue. You see its size, its slippage tolerance and its minimum received.
  2. Set the bot's front-run: a buy placed just before the swap. The bigger it is, the worse the swap fills; below its minimum received the swap reverts and the attack fails.
  3. Find the largest front-run the swap's tolerance allows. From level 3 some swaps are too tight to pay for the bot's fees and gas: skip those.
  4. Decrypt replays the block: the bot's buy, the swap, the bot's sell, and what it cost the person swapping. A run is 6 swaps.

How it is graded

The pool maths is exact on integer units. In attack rounds the answer is the largest front-run on the dial's grid that leaves the fill at or above the minimum received: one step over reverts the swap and is wrong, and up to 3% under still passes. In skip rounds the right answer is to skip. Every round agrees with the on-screen rule of thumb (bot profit about the victim's loss minus pool fees and gas) with room to spare.

The honest note

MEV is a real cost of trading on public blockchains. The bot here follows one fixed strategy; real ones compete and vary. Some tools claim to protect against MEV; how well they work varies and changes. The simplest defences are tight tolerances, smaller swaps and deeper pools.

The guides behind it