DefineDeFiWeb3 Glossary

Sandwich Attack

A type of MEV where someone puts transactions before AND after yours to profit. They 'sandwich' your trade to extract value.

Example

A bot seeing your large buy, buying first to raise the price, letting your trade execute at a worse price, then selling.

Related Terms

Advanced Concepts
Sandwich Attack SequenceShows how attackers front-run and back-run victim transactionsSandwich Attack: How You Get "Sandwiched"EarlierLaterπŸ₯ͺ Attacker BuysFront-run1Buys token firstRaises the price😒 Your TradeWorse price2Your buy executesAt inflated priceπŸ₯ͺ Attacker SellsBack-run3Sells for profitPockets the differenceAttacker's front-run buyYour trade (the "meat")Attacker's back-run sellπŸ›‘οΈ ProtectionUse low slippageor MEV protection

βš™οΈHow It Works

  1. 1

    Detection

    Attacker's bot monitors the mempool and spots your pending trade

  2. 2

    Front-run

    Bot submits a buy order BEFORE yours with higher gas to execute first

  3. 3

    Your Trade

    Your trade executes at a worse price because the bot moved the market

  4. 4

    Back-run

    Bot immediately sells, profiting from the price difference you caused

πŸ“ŠKey Numbers

1-3%
Avg Loss per Attack
of trade value
$1M+
Daily Sandwich Profits
extracted from users
1,000+
Attacks per Day
on Ethereum mainnet

πŸš€Getting Started

  • 1Use MEV protection services like Flashbots Protect or MEV Blocker
  • 2Set lower slippage tolerance (0.5-1%) to make attacks unprofitable
  • 3Break large trades into smaller chunks across time
  • 4Use DEX aggregators with private transaction options
  • 5Consider trading on L2s where MEV is less prevalent
Browse All Terms