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

  • DeFi Primitives

    DeFi Primitives: Basic Building BlocksDeFi primitives are fundamental financial functions like lending, borrowing, and trading that serve as building blocks for more complex decentralized finance applications. They're like Lego blocks for financial services.DeFi primitives refer to basic financial functions implemented as smart contracts that can be combined to create more complex financial products and services. These…

  • Security Token

    Security Token: Regulated Digital AssetsSecurity tokens are cryptocurrency tokens that represent ownership in real-world assets and are subject to securities regulations. They're like digital stock certificates that comply with financial laws.Security tokens are cryptocurrency tokens that represent ownership stakes in real-world assets and are subject to securities regulations and compliance requirements. These bridge traditional finance with…

  • EIP-2612

    EIP-2612: Permit Function for Token ApprovalsEIP-2612 introduces permit functions that allow token approvals through signatures instead of transactions. It's like giving someone permission to spend your money without having to make a separate payment for the permission slip.EIP-2612 is an Ethereum Improvement Proposal that adds permit functionality to ERC-20 tokens, enabling approvals through off-chain signatures…

  • Crypto Vesting Schedule

    Crypto Vesting Schedule: Gradual Token Release Vesting schedules control when team members, investors, or community members can access their allocated tokens. It’s like having a time-locked savings account that prevents dumping. A crypto vesting schedule defines when and how allocated tokens become available for use, typically spreading releases over months or years to prevent market…

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

  • Wei

    Wei: Ethereum's Smallest UnitWei is the smallest denomination of Ethereum, similar to how cents are the smallest unit of dollars. It's like measuring distances in millimeters when you need precision, even though we usually think in meters or kilometers.Wei represents the smallest possible unit of Ethereum (ETH), with one ETH equal to 1,000,000,000,000,000,000 (10^18) wei. This…