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

  • Security

    Security: Protecting Digital Assets and InformationSecurity in cryptocurrency encompasses all measures taken to protect digital assets, private keys, and personal information from theft or compromise. It's the foundation that makes cryptocurrency ownership safe and reliable.Security refers to the comprehensive protection of cryptocurrency assets, private keys, wallet access, and personal information through technical measures and careful…

  • Multisig Recovery

    Multisig Recovery: Getting Back Lost Access Multisig recovery helps regain access to multi-signature wallets when some keys are lost or compromised. It’s like having spare keys for your house, but with cryptographic mathematics. Multisig recovery refers to mechanisms that restore access to multi-signature wallets when the required number of signatures is no longer available due…

  • Real Yield

    Real Yield: Sustainable Return GenerationReal yield refers to returns generated from actual economic activity and revenue rather than token emissions or inflationary rewards. It's like earning interest from a bank's profitable lending operations instead of them just printing more money to pay you.Real yield describes investment returns generated from genuine economic activity, protocol revenue, or…

  • SocialFi

    SocialFi: Social Media Meets Financial Incentives SocialFi combines social networking with decentralized finance, rewarding users for creating content and engaging with communities. It’s like getting paid to post, but with actual economic models behind it. SocialFi refers to social finance applications that integrate social media features with DeFi economics, enabling users to monetize social interactions…

  • ZK-EVM

    ZK-EVM: Zero-Knowledge Ethereum Compatibility ZK-EVM provides Ethereum compatibility while using zero-knowledge proofs for scalability and privacy. It’s like having Ethereum that’s faster, cheaper, and more private. ZK-EVM is a zero-knowledge rollup that maintains full compatibility with Ethereum’s execution environment while using ZK proofs for validation. This enables existing Ethereum applications to run without modification while…

  • Due Diligence

    Due Diligence: Research Before InvestmentDue diligence involves thoroughly researching and evaluating cryptocurrency projects before investing. It's like test driving a car and checking its history before buying.Due diligence refers to the comprehensive investigation and analysis of cryptocurrency projects, including technology, team, tokenomics, and market factors before making investment decisions. Proper due diligence helps identify opportunities and…