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

  • Smart Order Routing

    Smart Order Routing: Optimal Trade Execution Smart order routing automatically finds the best prices across multiple exchanges and liquidity sources for each trade. It’s like having a shopping bot that checks every store for the best deal. Smart order routing is an algorithmic system that automatically splits and routes orders across multiple trading venues to…

  • Wallet Address

    Wallet Address: Your Cryptocurrency Bank Account NumberA wallet address is a unique identifier that enables receiving cryptocurrency payments. It's like a bank account number that others can send money to, but it's generated from your private keys.A wallet address is a unique alphanumeric string that serves as a destination for cryptocurrency transactions. These addresses are derived…

  • FUD (Fear, Uncertainty, Doubt)

    FUD: Fear, Uncertainty, and Doubt FUD is FOMO’s evil twin. While FOMO makes you buy at peaks, FUD makes you sell at bottoms. Understanding FUD helps you think clearly when markets panic. FUD stands for Fear, Uncertainty, and Doubt – negative sentiment spread to influence crypto prices downward. Sometimes it’s legitimate concerns, often it’s manufactured…

  • MEV (Maximal Extractable Value)

    MEV (Maximal Extractable Value): The Hidden Tax on DeFi MEV is the extra profit that miners and validators can extract by reordering, including, or excluding transactions within blocks. It’s like cutting in line at the blockchain cafeteria. Maximal Extractable Value (MEV) is the additional profit that block producers can capture by strategically ordering transactions, beyond…

  • Interoperability

    Interoperability: Blockchain Networks Working TogetherInteroperability enables different blockchain networks to communicate and share information seamlessly. It's like having universal translators for blockchain languages.Interoperability refers to the ability of different blockchain networks to communicate, share data, and interact with each other without requiring centralized intermediaries. This enables cross-chain applications and unified user experiences.How Blockchain Interoperability WorksCross-chain protocols enable…

  • Centralization Risk

    Centralization Risk: Single Point of Failure DangersCentralization risk refers to vulnerabilities created when critical functions are controlled by single entities rather than distributed among many participants. It's like having all eggs in one basket that could break everything at once.Centralization risk encompasses the potential negative impacts when blockchain networks, applications, or services become overly dependent…