Sandwich Attack

Sandwich Attack: Extracting Value from Your Trades

Sandwich attacks place trades before and after your transaction to manipulate prices and extract profit from your slippage. It’s like cutting in line twice – once in front of you and once behind you.

A sandwich attack involves placing a buy order immediately before a victim’s trade and a sell order immediately after to profit from the artificial price movement created by the victim’s transaction. The attacker extracts value through manipulated slippage.

How Sandwich Attacks Work

Front-running places a large buy order ahead of the victim’s purchase, artificially inflating the price before the victim’s transaction executes.

Back-running immediately sells the tokens at the inflated price after the victim’s purchase completes, capturing profit from the temporary price increase.

MEV extraction occurs as the attacker benefits from privileged information about pending transactions while the victim pays higher prices due to artificial slippage.

Infographic showing a sandwich attack sequence: normal price, front-run buy, victim’s inflated trade, and back-run sell for profit extraction

Real-World Examples

  • DEX trading on Uniswap and other AMMs frequently faces sandwich attacks during periods of high gas prices
  • Large swaps are particularly vulnerable as they create more price impact for attackers to exploit
  • MEV bots automatically detect profitable sandwich opportunities in mempool data

Why Beginners Should Care

Hidden tax on DeFi trading that can add 1-5% to transaction costs beyond visible slippage and gas fees, significantly impacting returns.

Protection strategies include using MEV-protected RPCs, private mempools, or protocols specifically designed to prevent sandwich attacks.

Market impact reduces overall DeFi efficiency as users pay more for trades while value gets extracted by sophisticated MEV operators.

Related Terms: MEV, Front-Running, Slippage, Back-Running

Back to Crypto Glossary

Similar Posts

  • DEX

    DEX: Decentralized ExchangeA DEX is a cryptocurrency exchange that operates without central authority through smart contracts. It's like a marketplace where buyers and sellers trade directly without a middleman.A decentralized exchange (DEX) is a cryptocurrency trading platform that facilitates peer-to-peer trading through smart contracts without requiring a central operator or intermediary. Users maintain control of their…

  • Vesting Schedule

    Vesting Schedule: Gradual Token ReleaseA vesting schedule controls when tokens become available to holders over time rather than all at once. It's like a salary that gets paid out in installments to ensure long-term commitment.A vesting schedule is a predetermined timeline that controls when cryptocurrency tokens become available for use, sale, or transfer. These schedules prevent…

  • CoinJoin

    CoinJoin: Bitcoin Transaction MixingCoinJoin combines multiple Bitcoin transactions into single transactions to obscure the connection between inputs and outputs. It's like mixing your laundry with other people's to make it harder to tell which clothes belong to whom.CoinJoin is a Bitcoin privacy technique that combines multiple transactions from different users into a single transaction, making…

  • Compound Interest

    Compound Interest: Exponential Growth ReturnsCompound interest is earned on both the initial investment and previously accumulated interest, creating exponential growth over time. It's like planting a tree where each year's growth makes the tree bigger, which then grows even more the following year.Compound interest refers to earning returns not only on the original principal amount…

  • Liquid Restaking

    Liquid Restaking: Flexible High-Yield Staking Liquid restaking combines the capital efficiency of liquid staking with additional yield from securing multiple networks. It’s like having your cake and eating it too, but with slashing risks. Liquid restaking allows staked assets to secure additional protocols while remaining liquid through tokenized representations. Users can earn enhanced yields from…

  • Treasury

    Treasury: Protocol Fund ManagementA treasury is a fund controlled by cryptocurrency projects or DAOs for development, operations, and community initiatives. It's like a company's bank account that's managed by community voting instead of executives.A treasury refers to cryptocurrency funds held and managed by protocols, DAOs, or projects for operational expenses, development funding, and community initiatives. These…