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

  • Multi-Signature (Multisig)

    Multi-Signature (Multisig): Shared Control for Enhanced Security Multisig wallets require multiple signatures to authorize transactions. It’s like requiring multiple keys to open a safe – no single person can move funds alone. Multi-signature (multisig) is a wallet configuration that requires signatures from multiple private keys to authorize transactions. Common setups include 2-of-3 (any 2 signatures…

  • Liquidity Mining

    Liquidity Mining: Earning Tokens for Providing LiquidityLiquidity mining rewards users with tokens for providing liquidity to decentralized exchanges and protocols. It's like getting paid to be a market maker in the digital asset ecosystem.Liquidity mining is an incentive mechanism where DeFi protocols distribute tokens to users who provide liquidity to trading pools, lending markets, or…

  • 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…

  • Sybil Attack

    Sybil Attack: Fake Identity Manipulation Sybil attacks involve creating multiple fake identities to gain disproportionate influence in networks that assume one person equals one vote. It’s like stuffing the ballot box with imaginary voters. A Sybil attack is when an individual or entity creates multiple fake identities to gain unfair influence over a network, voting…

  • EVM (Ethereum Virtual Machine)

    EVM (Ethereum Virtual Machine): The World Computer The EVM is the runtime environment where Ethereum smart contracts execute. It’s like having one giant computer that runs the same programs across thousands of machines worldwide. The Ethereum Virtual Machine (EVM) is a decentralized computing environment that executes smart contracts on the Ethereum blockchain. Every Ethereum node…

  • Synthetic Asset

    Synthetic Asset: Creating Anything on Blockchain Synthetic assets are blockchain tokens that track the value of real-world assets like stocks, commodities, or currencies. They’re like financial derivatives but programmable and globally accessible. A synthetic asset is a tokenized derivative that tracks the price of an underlying asset without requiring direct ownership of that asset. Smart…