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

  • Protocol Revenue

    Protocol Revenue: Earning from Network ActivityProtocol revenue refers to income generated by blockchain protocols through transaction fees, service charges, or other value capture mechanisms. It's like toll roads that collect fees from everyone who uses the infrastructure.Protocol revenue encompasses all income streams generated by blockchain protocols including transaction fees, service charges, governance fees, and other…

  • Token Allocation

    Token Allocation: Distributing Digital AssetsToken allocation determines how cryptocurrency tokens are distributed among different stakeholders like teams, investors, and communities. It's the blueprint for who gets what in crypto projects.Token allocation refers to the distribution plan for cryptocurrency tokens among various stakeholder groups including development teams, early investors, community members, and ecosystem development funds. This distribution…

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

  • ICO

    ICO: Initial Coin OfferingAn ICO is a fundraising method where new cryptocurrency projects sell tokens to early investors. It's like an IPO for stocks, but for new cryptocurrency tokens instead of company shares.An Initial Coin Offering (ICO) is a fundraising mechanism where cryptocurrency projects sell tokens to investors to raise capital for development and operations. ICOs…

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

  • Democratic Governance

    Democratic Governance: Community-Controlled Decision MakingDemocratic governance enables community members to participate in project decisions through voting and proposal systems. It's like having a democracy where token holders are the citizens.Democratic governance refers to decision-making systems where community members have voting rights and influence over project direction, protocol changes, and resource allocation. Token holdings typically determine voting…