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

  • Validator Set Rotation

    Validator Set Rotation: Dynamic Network Security Validator set rotation periodically changes which nodes validate transactions, preventing long-term centralization and maintaining network security through diversity. It’s like jury rotation for blockchain consensus. Validator set rotation is a mechanism that periodically changes which validators are active in securing a blockchain network. This prevents permanent centralization and ensures…

  • Rarity

    Rarity: Scarcity-Based Value AssessmentRarity refers to how uncommon or scarce particular traits, items, or attributes are within collections or ecosystems. It's like having a rare baseball card that's valuable because few others like it exist.Rarity describes the relative scarcity of digital assets, particularly NFT traits or characteristics, that affects their perceived value and market pricing. Rarer…

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

  • KYC (Know Your Customer)

    KYC (Know Your Customer): The Identity Check KYC is crypto’s concession to traditional finance. Exchanges collect your personal information to comply with government regulations and prevent money laundering. Know Your Customer (KYC) is the process of verifying customer identities through government-issued documents and personal information. Most regulated cryptocurrency exchanges require KYC before allowing significant trading…

  • Block Confirmation

    Block Confirmation: Transaction Security VerificationBlock confirmation refers to the number of blocks added to the blockchain after a transaction, indicating its security level. It's like waiting for concrete to fully harden before considering construction complete.Block confirmation is the number of blocks that have been added to the blockchain after the block containing a specific transaction. More…

  • Regulatory Compliance

    Regulatory Compliance: Following Government RulesRegulatory compliance involves adhering to government laws and regulations that apply to cryptocurrency activities. It's like following traffic laws, but for digital money.Regulatory compliance refers to conforming with applicable laws, regulations, and supervisory requirements for cryptocurrency businesses, transactions, and activities. Compliance requirements vary significantly between jurisdictions and continue evolving.How Crypto Compliance WorksKnow…