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

  • Price Stability

    Price Stability: Maintaining Consistent ValuePrice stability refers to maintaining consistent cryptocurrency values over time with minimal volatility. It enables practical use as medium of exchange and store of value.Price stability describes the characteristic of maintaining relatively constant value over time with limited price fluctuations. This stability is essential for practical cryptocurrency adoption in payments and savings.How…

  • Smart Contract Compatibility

    Smart Contract Compatibility: Cross-Platform Code ExecutionSmart contract compatibility enables applications to run across different blockchain networks without modification. It's like writing software that works on both Windows and Mac without changes.Smart contract compatibility refers to the ability of smart contract code to execute on multiple blockchain platforms without requiring rewrites or significant modifications. This enables broader…

  • Premium

    Premium: Price Above Fair ValuePremium refers to the amount by which an asset's price exceeds its underlying value or reference price. It's like paying extra for convenience or brand name compared to the basic product cost.Premium is the additional amount paid above an asset's fair value, net asset value, or reference price. In cryptocurrency markets, premiums…

  • Yield Farming

    Yield Farming: Crypto’s High-Risk, High-Reward Game Yield farming is DeFi’s answer to traditional investing – except the yields are higher, the risks are bigger, and the game changes daily. Yield farming is the practice of lending, staking, or providing liquidity with your cryptocurrency to earn maximum returns across multiple DeFi protocols. It’s like playing musical…

  • LayerZero

    LayerZero: Omnichain Interoperability Protocol LayerZero is an interoperability protocol that enables applications to send messages and transfer assets across different blockchains. It’s like having a universal translator for blockchain networks. LayerZero is a cross-chain communication protocol that enables decentralized applications to operate across multiple blockchains seamlessly. It provides infrastructure for omnichain applications that can access…

  • Team Doxxing

    Team Doxxing: Revealing Anonymous IdentitiesTeam doxxing involves revealing the real identities of previously anonymous cryptocurrency project team members. It's like unmasking superheroes to show who's really behind the project.Team doxxing refers to the disclosure of real identities, backgrounds, and personal information of cryptocurrency project team members who were previously anonymous or pseudonymous. This can be voluntary…