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

  • Gas Fees

    Gas Fees: The Cost of Using Ethereum Gas fees are the tolls you pay to use Ethereum. Sometimes they’re pennies, sometimes they’re hundreds of dollars. Welcome to decentralized computing. Gas fees are transaction costs paid to miners or validators for processing transactions on blockchain networks. Think of gas as the fuel needed to power your…

  • Bonding Curve

    Bonding Curve: Algorithmic Token Pricing Bonding curves use mathematical formulas to automatically price tokens based on supply. As more tokens get bought, prices increase predictably according to the curve’s formula. A bonding curve is an algorithmic pricing mechanism that determines token price based on token supply through a mathematical function. Prices increase as supply grows…

  • Democratic Governance

    Democratic Governance: Community-Controlled Decision MakingDemocratic governance enables community members to participate in project decisions through voting and proposal systems. It's like having a democracy where token holders are the citizens.Democratic governance refers to decision-making systems where community members have voting rights and influence over project direction, protocol changes, and resource allocation. Token holdings typically determine voting…

  • On-Chain Gaming

    On-Chain Gaming: Fully Decentralized Games On-chain gaming runs game logic entirely on blockchain networks rather than traditional servers. It’s like having board games where the rules are enforced by mathematics instead of human referees. On-chain gaming executes all game logic, state management, and interactions through smart contracts on blockchain networks. Unlike traditional games with centralized…

  • DeFi Insurance

    DeFi Insurance: Protecting Against Smart Contract Risk DeFi insurance provides coverage against smart contract failures, hacks, and protocol exploits. It’s like buying fire insurance for your digital assets in experimental financial protocols. DeFi insurance offers protection against losses from smart contract bugs, hacks, oracle failures, and other technical risks in decentralized finance protocols. Users pay…

  • Gwei

    Gwei: Ethereum’s Gas Price Unit Gwei is the denomination used for Ethereum gas prices. Understanding gwei helps you avoid overpaying for transactions when the network gets congested. Gwei (gigawei) is a unit of Ethereum’s native currency equal to one billionth of an ETH (10^-9 ETH). It’s the standard unit for expressing gas prices, making it…