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…

  • Validator Jailing

    Validator Jailing: Temporary Network Punishment Validator jailing temporarily removes misbehaving validators from consensus participation while allowing them to return after penalties. It’s like being sent to the penalty box in hockey. Validator jailing is a punishment mechanism that temporarily excludes validators from consensus participation and rewards due to violations like extended downtime or rule infractions….

  • Go

    Go: Programming Language for BlockchainGo is a programming language widely used for building blockchain infrastructure and cryptocurrency applications. It's like the construction language for digital money systems.Go (also called Golang) is a programming language developed by Google that's popular for blockchain development due to its performance, simplicity, and excellent concurrency support. Many major cryptocurrency projects use…

  • Modular Execution Layer

    Modular Execution Layer: Specialized Transaction Processing Modular execution layers handle transaction processing separately from consensus and data availability. It’s like having specialized assembly lines instead of one worker doing everything. A modular execution layer is a specialized blockchain component that focuses solely on processing transactions and executing smart contracts while relying on other layers for…

  • Tokenomics

    Tokenomics: The Economics of Digital Assets Tokenomics determines how cryptocurrencies create, distribute, and maintain value over time. It’s the difference between digital money and digital monopoly money. Tokenomics refers to the economic design and mechanics of a cryptocurrency token, including supply schedules, distribution methods, utility functions, and incentive structures. Good tokenomics align stakeholder interests while…

  • Liquidity Mining

    Liquidity Mining: Earning Rewards for Providing Liquidity Liquidity mining rewards users who provide capital to DeFi protocols with governance tokens. It’s like getting paid to be the house money at a casino. Liquidity mining is a DeFi incentive mechanism where protocols distribute governance tokens to users who provide liquidity to their platforms. Users earn both…