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

  • Compliance

    Compliance: Following Regulatory RequirementsCompliance involves adhering to laws, regulations, and industry standards that govern cryptocurrency activities. It's like following traffic laws, but for digital money and blockchain businesses.Compliance refers to conforming with applicable laws, regulations, licensing requirements, and industry standards for cryptocurrency operations. This includes financial regulations, tax obligations, and consumer protection measures.How Crypto Compliance WorksRegulatory…

  • Web3

    Web3: The Decentralized Internet Dream Web3 promises an internet where users own their data, identity, and digital assets instead of tech giants controlling everything. It’s part vision, part reality, part marketing buzzword. Web3 refers to a decentralized version of the internet built on blockchain technology where users control their own data, identity, and assets rather…

  • Sequencer

    Sequencer: Transaction Order ControllerA sequencer determines the order in which transactions are processed in Layer 2 networks and some blockchain systems. It's like the traffic controller that decides which cars go through the intersection first.A sequencer is a component in Layer 2 scaling solutions that collects, orders, and batches transactions before submitting them to the…

  • Leverage

    Leverage: Borrowing Money to Amplify TradesLeverage lets you control larger positions than your actual capital by borrowing funds from exchanges or platforms. It's like using a lever to lift heavy objects – small movements create big effects.Leverage in cryptocurrency trading allows borrowing funds to increase position sizes beyond available capital, amplifying both potential profits and…

  • Monetary Policy

    Monetary Policy: Controlling Money SupplyMonetary policy refers to how money supply, interest rates, and economic incentives are managed within a currency system. In crypto, it's usually controlled by code instead of central banks.Monetary policy encompasses the rules and mechanisms that control cryptocurrency supply, inflation rates, and economic incentives within blockchain networks. Unlike traditional currencies, crypto monetary…

  • Seed Phrase

    Seed Phrase: Your Crypto Recovery Backup Your seed phrase is your crypto’s ultimate backup. More important than passwords, more valuable than the device itself. A seed phrase is a list of 12-24 words that can restore access to all your cryptocurrency wallets and funds. It’s your master key – lose it and your crypto is…