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

  • Yield Engineering

    Yield Engineering: Manufacturing ReturnsYield engineering creates artificial income streams through complex financial strategies and derivative products. It's like building a return-generating machine from financial spare parts.Yield engineering refers to creating yield opportunities through structured products, derivatives, and complex strategies rather than from underlying asset productivity. These engineered returns often involve multiple moving parts and sophisticated risk…

  • Launchpad

    Launchpad: The Crypto Startup Accelerator Launchpads are platforms that help new crypto projects raise funds and launch tokens. They’re like Kickstarter for cryptocurrencies, but with more speculation and less product delivery. A launchpad is a platform that facilitates fundraising and token launches for new cryptocurrency projects. They provide infrastructure, marketing, and community access to help…

  • Proof of Work (PoW)

    Proof of Work (PoW): Bitcoin’s Security Model Proof of Work is how Bitcoin solves the double-spending problem without trusted authorities. It’s energy-intensive by design – that’s a feature, not a bug. Proof of Work is a consensus mechanism where miners compete to solve computationally difficult puzzles to validate transactions and create new blocks. The winning…

  • Rehypothecation

    Rehypothecation: Reusing Collateral Multiple Times Rehypothecation involves using the same collateral to back multiple obligations simultaneously. It’s like using your house as collateral for three different loans at the same time. Rehypothecation is the practice of using customer assets as collateral for the institution’s own borrowing or trading activities. In DeFi, this creates leverage and…

  • Computational Mining

    Computational Mining: Earning Through Processing PowerComputational mining involves providing computer processing power to networks in exchange for cryptocurrency rewards. It's like renting out your computer's brain for digital money.Computational mining refers to using computer hardware to perform calculations for blockchain networks or distributed computing projects in exchange for cryptocurrency payments. This enables monetizing spare computing resources.How…

  • Smart Contract Risk

    Smart Contract Risk: Code-Based VulnerabilitiesSmart contract risk encompasses all potential vulnerabilities and failures in automated blockchain programs. It's like the risk that the software controlling your digital money might have bugs or be exploited.Smart contract risk refers to potential losses from bugs, vulnerabilities, exploits, or unexpected behavior in smart contract code that controls cryptocurrency assets…