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

  • Transaction Privacy

    Transaction Privacy: Protecting Financial InformationTransaction privacy keeps cryptocurrency transaction details confidential while maintaining network security. It's like having private bank accounts in a transparent financial system.Transaction privacy refers to techniques that conceal cryptocurrency transaction information such as sender addresses, recipient addresses, and transaction amounts from public observation. This enables financial privacy while maintaining blockchain functionality.How Transaction…

  • Risk Assessment

    Risk Assessment: Evaluating Investment DangersRisk assessment involves systematically analyzing potential losses and their probabilities before making investment decisions. It's like checking the weather and road conditions before planning a trip.Risk assessment is the process of identifying, analyzing, and evaluating potential risks associated with cryptocurrency investments or activities to make informed decisions. This includes technical, market, regulatory,…

  • HTLC

    HTLC: Hash Time-Locked ContractsHTLCs are smart contracts that lock cryptocurrency until specific conditions are met within time limits. They're like escrow services with built-in deadlines that automatically return funds if deals fall through.Hash Time-Locked Contracts (HTLCs) are smart contracts that require both cryptographic proof and time-based conditions to be met before cryptocurrency can be accessed. These…

  • Network Decentralization

    Network Decentralization: Distributed Control ArchitectureNetwork decentralization refers to distributing control and operation of blockchain networks across many independent participants rather than concentrating power. It's like having a town where decisions are made by all residents voting together instead of a single mayor controlling everything.Network decentralization describes the distribution of control, validation, and governance functions across…

  • Dynamic NFTs (dNFTs)

    Dynamic NFTs (dNFTs): Evolving Digital Assets Dynamic NFTs can change their metadata, appearance, or properties based on external data or on-chain events. They’re like digital collectibles that grow and evolve over time. Dynamic NFTs (dNFTs) are non-fungible tokens that can modify their metadata, attributes, or visual appearance in response to external data feeds, user actions,…

  • Token Launch

    Token Launch: Cryptocurrency Project DebutA token launch is the initial release of a new cryptocurrency token to the public market. It's like a product launch where a company introduces a new product, but for digital currencies instead of physical goods.Token launch refers to the process of introducing a new cryptocurrency token to the market, including…