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

  • Order Matching

    Order Matching: Connecting Buyers and SellersOrder matching is the process of pairing buy and sell orders to execute trades on exchanges. It's like a digital matchmaker that finds the perfect trading partners for each transaction.Order matching refers to the algorithmic process that pairs compatible buy and sell orders to execute trades at agreed prices on…

  • Chain Abstraction

    Chain Abstraction: Invisible Multi-Chain Experience Chain abstraction hides blockchain complexity from users, making multi-chain interactions feel like using a single network. It’s like having universal currency that works everywhere without exchange rates. Chain abstraction creates user experiences where interactions with multiple blockchains happen seamlessly without users needing to understand or manage different networks, tokens, or…

  • Cross-Chain Protocol

    Cross-Chain Protocol: Blockchain Communication StandardsCross-chain protocols establish standardized methods for different blockchain networks to communicate and transfer assets safely. They're like diplomatic translation services that enable countries speaking different languages to negotiate treaties and trade agreements.Cross-chain protocols are standardized communication frameworks that enable different blockchain networks to exchange information, transfer assets, and coordinate operations across…

  • Governance Token

    Governance Token: Voting Rights in Digital Form Governance tokens turn users into stakeholders with voting power over protocol decisions. It’s democracy meets DeFi, with mixed results. A governance token grants holders voting rights on protocol decisions like parameter changes, upgrade proposals, treasury spending, and strategic direction. Token weight typically determines voting power – more tokens…

  • WAGMI (We’re All Gonna Make It)

    WAGMI: Crypto’s Battle Cry WAGMI (We’re All Gonna Make It) is crypto’s rallying cry during tough times. It represents community solidarity and shared optimism about long-term success. WAGMI stands for “We’re All Gonna Make It” – a popular crypto community phrase expressing collective optimism about future success despite current market conditions. It originated from bodybuilding…

  • DeFi Security

    DeFi Security: Protecting Decentralized FinanceDeFi security involves protecting decentralized finance protocols and users from smart contract vulnerabilities, economic attacks, and operational risks. It's cybersecurity for programmable money.DeFi security encompasses the practices, technologies, and protocols used to protect decentralized finance applications from hacks, exploits, and other security threats. This includes smart contract auditing, economic security, and user…