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

  • Capital Efficiency

    Capital Efficiency: Maximizing Resource UtilizationCapital efficiency measures how effectively investments generate returns relative to the amount of capital deployed. It's like getting the most miles per gallon from your investment fuel.Capital efficiency refers to maximizing returns or utility from invested capital through optimal allocation, leverage, or innovative strategies that reduce required capital while maintaining or…

  • Price Impact

    Price Impact: Trade Size Effect on Market PricesPrice impact refers to how trading activity affects cryptocurrency prices, particularly when large orders move markets significantly. It's like how jumping into a small pool creates bigger waves than jumping into an ocean.Price impact is the effect that trading activity has on cryptocurrency prices, with larger trades typically…

  • Digital Currency

    Digital Currency: Electronic Money SystemsDigital currency refers to money that exists only in electronic form, including both centralized and decentralized varieties. It's like having money that lives entirely in computers and phones instead of physical bills and coins in your wallet.Digital currency encompasses all forms of money that exist exclusively in electronic format, including cryptocurrencies,…

  • Real Yield

    Real Yield: Sustainable Revenue-Based Returns Real yield comes from actual protocol revenue rather than token emissions or inflationary rewards. It’s the difference between earning from productive business activity versus printing more money. Real yield refers to returns generated from genuine protocol revenue, fees, or value creation rather than token inflation or emissions. These yields can…

  • Ring Signatures

    Ring Signatures: Anonymous Group AuthorizationRing signatures enable one member of a group to create signatures on behalf of the group without revealing which specific member signed. It's like having a group of people where any one can speak for the group anonymously, but observers know the statement came from a legitimate group member.Ring signatures are…

  • Synthetic Asset

    Synthetic Asset: Creating Anything on Blockchain Synthetic assets are blockchain tokens that track the value of real-world assets like stocks, commodities, or currencies. They’re like financial derivatives but programmable and globally accessible. A synthetic asset is a tokenized derivative that tracks the price of an underlying asset without requiring direct ownership of that asset. Smart…