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 Lending

    DeFi Lending: Decentralized Borrowing and LendingDeFi lending enables cryptocurrency borrowing and lending without traditional financial intermediaries through smart contracts. It's like peer-to-peer banking powered by code instead of humans.DeFi lending refers to decentralized finance protocols that enable users to lend and borrow cryptocurrencies through smart contracts without requiring traditional banks or credit checks. These systems operate…

  • Dust

    Dust: Tiny Amounts That Clog Networks Dust refers to cryptocurrency amounts so small they’re not economically viable to spend due to transaction fees exceeding their value. It’s like having pennies that cost dollars to use. Dust consists of very small amounts of cryptocurrency that cost more in transaction fees to send than their actual value….

  • Liquid Staking

    Liquid Staking: Staking Without LockupsLiquid staking allows earning staking rewards while maintaining the ability to trade or use staked assets through tokenized representations. It's like having your cake and eating it too.Liquid staking enables users to stake cryptocurrency for rewards while receiving liquid tokens representing their staked position that can be traded or used in…

  • EVM (Ethereum Virtual Machine)

    EVM (Ethereum Virtual Machine): The World Computer The EVM is the runtime environment where Ethereum smart contracts execute. It’s like having one giant computer that runs the same programs across thousands of machines worldwide. The Ethereum Virtual Machine (EVM) is a decentralized computing environment that executes smart contracts on the Ethereum blockchain. Every Ethereum node…

  • Optimistic Rollup

    Optimistic Rollup: Trust but Verify Scaling Optimistic rollups assume transactions are valid by default but allow challenges during dispute periods. It’s like innocent until proven guilty for blockchain transactions. An optimistic rollup is a Layer 2 scaling solution that assumes transactions are valid by default and only verifies them if someone submits a fraud proof…

  • Atomic Swap

    Atomic Swap: Trustless Cross-Chain Trading Atomic swaps enable direct trading between different cryptocurrencies without exchanges or intermediaries. Either both trades complete successfully, or neither happens – no middle ground. An atomic swap is a smart contract technology that enables the exchange of cryptocurrencies from different blockchains without requiring a trusted third party. The swap either…