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

  • Token Lockup

    Token Lockup: Preventing Early Selling Token lockups prevent allocated tokens from being sold or transferred for specific time periods. It’s like putting your poker winnings in a time-locked safe to prevent impulse spending. Token lockup is a mechanism that prevents token holders from selling, transferring, or accessing their tokens until predetermined conditions are met. Lockups…

  • Data Sampling

    Data Sampling: Efficient Information VerificationData sampling enables verifying large datasets by checking small random portions rather than downloading everything. It's like quality control testing that checks samples instead of every item.Data sampling refers to techniques for verifying data integrity and availability by examining small random portions of larger datasets. This enables efficient verification without requiring full…

  • Market Cap

    Market Cap: How to Value Crypto Projects Market cap tells you how much the entire crypto market values a project. It’s the most important number for comparing different cryptocurrencies. Market capitalization is the total value of all coins in circulation, calculated by multiplying the current price by the circulating supply. It shows the relative size…

  • Meta Transactions

    Meta Transactions: Gasless User InteractionsMeta transactions enable users to interact with blockchain applications without paying gas fees directly. It's like having someone else pay your transaction fees while you control the actual operations.Meta transactions are blockchain transactions where the gas fees are paid by a third party (relayer) while the user maintains control over the…

  • Collection

    Collection: Grouped NFT SeriesA collection is a group of related NFTs that share common themes, artwork, or attributes. It's like a series of trading cards or stamps that belong to the same set.A collection refers to a group of related NFTs that share common characteristics, themes, or attributes, typically created by the same artist or…

  • Digital Currency

    Digital Currency: Electronic Money SystemsDigital currency refers to money that exists only in electronic form, including both centralized and decentralized varieties. It's like having money that lives entirely in computers and phones instead of physical bills and coins in your wallet.Digital currency encompasses all forms of money that exist exclusively in electronic format, including cryptocurrencies,…