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

  • Bear Market

    Bear Market: When Reality Hits Crypto Bear markets separate tourists from residents. Prices fall, optimism dies, and everyone learns who was swimming naked when the tide goes out. A bear market is a sustained period of declining cryptocurrency prices accompanied by widespread investor pessimism. During bear markets, even strong projects can lose 80-90% of their…

  • ICO

    ICO: Initial Coin OfferingAn ICO is a fundraising method where new cryptocurrency projects sell tokens to early investors. It's like an IPO for stocks, but for new cryptocurrency tokens instead of company shares.An Initial Coin Offering (ICO) is a fundraising mechanism where cryptocurrency projects sell tokens to investors to raise capital for development and operations. ICOs…

  • Blockchain Trilemma

    Blockchain Trilemma: The Impossible TrinityThe blockchain trilemma describes the challenge of simultaneously achieving decentralization, security, and scalability in blockchain networks. It's like trying to be fast, cheap, and high-quality all at the same time.The blockchain trilemma refers to the fundamental trade-off between three key properties: decentralization, security, and scalability, where optimizing for two typically requires…

  • Security

    Security: Protecting Digital Assets and InformationSecurity in cryptocurrency encompasses all measures taken to protect digital assets, private keys, and personal information from theft or compromise. It's the foundation that makes cryptocurrency ownership safe and reliable.Security refers to the comprehensive protection of cryptocurrency assets, private keys, wallet access, and personal information through technical measures and careful…

  • Regulation

    Regulation: Government Rules for CryptoCryptocurrency regulation involves government rules and oversight for digital assets, exchanges, and blockchain businesses. It's the ongoing battle between innovation and compliance.Regulation refers to government laws, rules, and oversight mechanisms that govern cryptocurrency activities, including trading, taxation, anti-money laundering compliance, and consumer protection. Regulatory approaches vary significantly between jurisdictions.How Crypto Regulation WorksLicensing…

  • Transaction Fees

    Transaction Fees: Network Processing CostsTransaction fees are payments made to network validators for processing and confirming cryptocurrency transactions. They're like postage stamps that you need to attach to letters, except the cost varies depending on how quickly you want your mail delivered.Transaction fees refer to payments made to miners, validators, or network operators who process…