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

  • Cold Wallet

    Cold Wallet Backup: Securing Your Security Cold wallet backup ensures you can recover your cryptocurrency even if your hardware wallet is lost, stolen, or destroyed. It’s like having spare keys to your safe deposit box. Cold wallet backup refers to secure storage methods for seed phrases and recovery information that enable restoring access to hardware…

  • Double Spending

    Double Spending: Using Digital Money TwiceDouble spending is the risk of using the same digital currency twice in different transactions. It's like making photocopies of cash and trying to spend each copy separately.Double spending refers to the potential problem where the same digital currency unit could be spent multiple times, which blockchain technology specifically prevents…

  • Liquidity Pool

    Liquidity Pool: The Fuel That Powers DEX Trading Liquidity pools are why decentralized exchanges work. They’re shared pots of tokens that enable trading without traditional buyers and sellers. A liquidity pool is a collection of tokens locked in a smart contract that provides liquidity for decentralized trading. Instead of matching buy and sell orders, traders…

  • Marketplace

    Marketplace: Digital Trading PlatformsMarketplaces are platforms where users can buy, sell, and trade digital assets like NFTs, tokens, or services. They're like eBay but for blockchain-based items.A marketplace is a platform that facilitates buying, selling, and trading of digital assets between users, typically including discovery, pricing, and transaction features. These platforms often specialize in specific asset…

  • UTXO

    UTXO: Unspent Transaction OutputsUTXOs are like digital coins in your wallet that you haven't spent yet. Bitcoin tracks every unspent "coin" to prevent double-spending and maintain accurate balances.UTXO stands for Unspent Transaction Output – pieces of bitcoin that remain after a transaction and can be used as inputs for future transactions. Think of them as individual…

  • Token Economy

    Token Economy: Digital Asset EcosystemsToken economies are systems where digital tokens serve as medium of exchange, store of value, and incentive mechanisms within specific ecosystems. They're like creating your own mini-economy with digital money.A token economy refers to an ecosystem where cryptocurrency tokens facilitate economic activity, incentivize participation, and coordinate behavior among participants. These economies can…