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

  • Fee Sharing

    Fee Sharing: Distributing Protocol RevenueFee sharing distributes a portion of protocol revenues to token holders, stakers, or other participants. It's like getting dividends from a company you own shares in.Fee sharing refers to mechanisms that distribute portions of protocol fees, transaction costs, or other revenues to token holders or network participants. This creates direct financial incentives…

  • Encrypted Mempool

    Encrypted Mempool: Private Transaction Pools Encrypted mempools hide transaction details until inclusion in blocks, preventing front-running and MEV extraction. It’s like sending sealed bids instead of announcing your strategy publicly. An encrypted mempool contains pending transactions that are cryptographically hidden from public view until block inclusion. This prevents sophisticated actors from front-running or extracting MEV…

  • Decentralization

    Decentralization: Power to the People Decentralization distributes control away from single authorities across many independent participants. It’s the difference between having one king versus a thousand voters making decisions. Decentralization refers to the distribution of power, control, and decision-making away from central authorities to a network of independent participants. In blockchain systems, this means no…

  • Zero-Knowledge Proof (ZKP)

    Zero-Knowledge Proof (ZKP): Proving Without Revealing Zero-knowledge proofs let you prove you know something without revealing what you know. It’s like proving you’re over 21 without showing your birth date, address, or any other personal information. A zero-knowledge proof (ZKP) is a cryptographic method that allows one party to prove they possess certain information without…

  • Asset Rehypothecation

    Asset Rehypothecation: Reusing Collateral for Multiple PurposesAsset rehypothecation involves using the same collateral for multiple financial purposes simultaneously. It's like using your house as collateral for multiple loans at the same time.Asset rehypothecation refers to the practice of using deposited or pledged assets as collateral for additional financial activities beyond their original purpose. This can multiply…

  • Wallet Connect

    Wallet Connect: Universal dApp Connection Standard WalletConnect is an open protocol that enables secure connections between mobile wallets and desktop applications. It’s like Bluetooth for crypto wallets and dApps. WalletConnect is a communication protocol that allows cryptocurrency wallets to interact with decentralized applications across different devices and platforms. It enables secure, encrypted connections without exposing…