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

  • Capitulation

    Capitulation: Market Surrender and Mass SellingCapitulation occurs when investors give up hope and sell their holdings en masse, often marking market bottoms. It's like throwing in the towel when everything seems hopeless.Capitulation refers to the point where investors abandon hope and sell their cryptocurrency holdings in large volumes, typically occurring near market bottoms after prolonged…

  • Atomic Transaction

    Atomic Transaction: All-or-Nothing OperationsAn atomic transaction either completes entirely or fails completely, with no partial execution possible. It's like a package deal where you get everything or nothing at all.An atomic transaction is an operation that either succeeds completely or fails entirely, ensuring that all components of a complex transaction execute together or none execute…

  • Fee Market

    Fee Market: Transaction Cost EconomicsA fee market determines transaction costs through supply and demand dynamics between users and network capacity. It's like surge pricing for blockchain transactions during busy periods.A fee market is an economic system where transaction fees are determined by competition between users for limited blockchain processing capacity. Higher demand relative to supply drives…

  • Social Recovery

    Social Recovery: Community-Based Account RecoverySocial recovery allows regaining access to cryptocurrency accounts through trusted contacts rather than relying solely on seed phrases. It's like having friends hold spare keys to your house.Social recovery is a wallet security mechanism that enables account recovery through a network of trusted contacts rather than requiring users to manage seed…

  • Smart Contract Analysis

    Smart Contract Analysis: Code Security EvaluationSmart contract analysis involves examining blockchain code for vulnerabilities, bugs, and security issues before deployment. It's like having a building inspector check the foundation before construction begins.Smart contract analysis refers to the systematic examination of smart contract code to identify security vulnerabilities, logic errors, and potential attack vectors. This process helps…

  • Diamond Hands

    Diamond Hands: Unshakeable Conviction Diamond hands represent the ultimate HODLer mentality – holding through extreme volatility without selling. It’s a badge of honor in crypto communities. Diamond hands refers to the unwavering determination to hold cryptocurrency positions through significant price volatility and market stress. It celebrates investors who resist selling during crashes or euphoric peaks….