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

  • Dark Web

    Dark Web: Hidden Internet NetworksThe dark web consists of encrypted online networks accessible only through specialized software like Tor. It's where privacy advocates and criminals both hang out, but for very different reasons.The dark web refers to encrypted online content that exists on overlay networks requiring specific software, configurations, or authorization to access. Unlike the regular…

  • Soft Fork

    Soft Fork: Backward-Compatible Upgrades Soft forks tighten blockchain rules without breaking compatibility. They’re the diplomatic approach to network upgrades – everyone can still participate even if they don’t upgrade immediately. A soft fork is a backward-compatible change to blockchain protocol rules that makes previously valid blocks invalid while keeping previously invalid blocks invalid. Old nodes…

  • Avatar

    Avatar: Digital Identity RepresentationAn avatar is a digital representation of a user's identity in virtual worlds, games, or online platforms. In crypto, avatars often take the form of NFTs that represent unique digital identities.An avatar is a digital representation of a user's identity or persona, often taking the form of NFTs or profile pictures that…

  • Mobile Wallet

    Mobile Wallet: Cryptocurrency on Your PhoneMobile wallets are smartphone applications that store, send, and receive cryptocurrency. They're like having a digital bank in your pocket with global reach.A mobile wallet is a smartphone application that enables users to store, manage, and transact with cryptocurrencies directly from their mobile devices. These wallets prioritize convenience and accessibility for…

  • Transparency

    Transparency: Open Information AccessTransparency in cryptocurrency refers to the open, verifiable nature of blockchain data that allows anyone to inspect transactions and network operations. It's like having buildings made entirely of glass where you can see exactly what's happening inside every room.Transparency describes the property of blockchain systems that makes transaction data, network operations, and…

  • Anti-Sybil Mechanism

    Anti-Sybil Mechanism: Preventing Fake Identity Attacks Anti-Sybil mechanisms prevent individuals from creating multiple fake identities to gain unfair advantages in voting, airdrops, or governance systems. They’re like requiring photo ID to prevent ballot stuffing. Anti-Sybil mechanisms are systems designed to prevent or detect when single entities create multiple fake identities to manipulate voting, governance, or…