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

  • Node

    Node: The Network’s Backbone Nodes are individual computers that maintain copies of the blockchain and enforce network rules. They’re the distributed infrastructure that makes cryptocurrency possible. A node is a computer that participates in a blockchain network by maintaining a copy of the distributed ledger and relaying transactions. Nodes validate transactions, store blockchain history, and…

  • Layer 2

    Layer 2: Scaling Solutions for Expensive Blockchains Layer 2 networks solve Ethereum’s biggest problem – ridiculous gas fees. They process transactions cheaply and quickly while inheriting Ethereum’s security. Layer 2 is a separate blockchain or protocol built on top of a main blockchain (Layer 1) to improve scalability and reduce transaction costs. These solutions handle…

  • Collection

    Collection: Grouped NFT SeriesA collection is a group of related NFTs that share common themes, artwork, or attributes. It's like a series of trading cards or stamps that belong to the same set.A collection refers to a group of related NFTs that share common characteristics, themes, or attributes, typically created by the same artist or…

  • Transaction Analysis

    Transaction Analysis: Blockchain Data InvestigationTransaction analysis involves examining blockchain data to understand patterns, track funds, and investigate suspicious activities. It's like being a detective who follows money trails in the digital world.Transaction analysis refers to the systematic examination of blockchain transaction data to identify patterns, trace fund flows, and investigate potential illegal or suspicious activities. This…

  • Algorithmic Stablecoin

    Algorithmic Stablecoin: Code-Controlled Price StabilityAlgorithmic stablecoins maintain price stability through automated mechanisms rather than asset backing. They're like self-driving cars for currency stability – controlled by code instead of human intervention.An algorithmic stablecoin is a cryptocurrency that maintains price stability through automated protocols and market mechanisms rather than collateral backing. These systems use smart contracts to…

  • 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…