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

  • Batch Verification

    Batch Verification: Efficient Bulk ProcessingBatch verification processes multiple transactions or proofs together to improve efficiency and reduce computational costs. It's like grading a stack of tests all at once instead of one by one.Batch verification refers to techniques that verify multiple cryptographic proofs, transactions, or operations simultaneously rather than processing each individually. This approach significantly improves…

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

  • Price Discovery

    Price Discovery: Finding Fair Market ValuePrice discovery is the process by which markets determine the fair value of assets through buyer and seller interactions. It's like a continuous auction where everyone votes with their money.Price discovery refers to the mechanism by which markets establish asset prices through the interaction of supply and demand from buyers…

  • Rollup-as-a-Service (RaaS)

    Rollup-as-a-Service (RaaS): Custom Blockchain Infrastructure RaaS platforms provide infrastructure for deploying custom rollups without building all the technical components from scratch. It’s like having a franchise model for blockchain networks. Rollup-as-a-Service (RaaS) provides infrastructure and tooling for organizations to deploy their own application-specific rollups without deep blockchain development expertise. These platforms handle the technical complexity…

  • Timelock

    Timelock: Time-Based Access ControlTimelock mechanisms prevent access to funds or functions until predetermined time conditions are met. It's like having a safe that only opens at specific times.A timelock is a smart contract feature that restricts access to funds, functions, or actions until a specified time period has elapsed. These mechanisms provide security through delayed execution…

  • Scaling

    Scaling: Handling More TransactionsScaling refers to increasing a blockchain network's capacity to handle more transactions per second without sacrificing security or decentralization. It's the holy grail of blockchain development.Scaling in blockchain technology involves improving transaction throughput, reducing costs, and maintaining performance as networks grow in size and usage. This typically requires technical solutions that balance speed,…