MEV sandwich attacks are among the most predatory and costly threats in DeFi. To help you better understand sandwich attacks, how they work, and how you can avoid the risk entirely, here are answers to some frequently asked questions.
What is a sandwich attack?
A sandwich attack is a type of MEV (Maximal Extractable Value) exploit that manipulates transactions within a single block on a blockchain. Malicious bots exploit DeFi users by sandwiching their trades between front-running and back-running transactions, profiting at the user’s expense.
Here’s how it works:
Front-running: The attacker detects a pending trade (usually a large buy order) and places their own buy order first, inflating the price.
User’s trade: The user’s trade executes at the now inflated price, leaving them with fewer tokens than expected.
Back-running: The attacker sells their tokens at the higher price, locking in a profit and leaving the user with losses.
This is a systemic issue in DeFi, especially for trades executed on AMMs (Automated Market Makers).
Why are sandwich attacks so common in DeFi?
DeFi operates on distributed public ledgers, meaning anyone can monitor pending transactions. This transparency, combined with the mechanics of AMMs, creates ideal conditions for malicious bots to detect vulnerable trades and execute sandwich attacks.
Key factors that make users susceptible:
Public transaction mempools: Pending transactions are visible to everyone, including bots.
AMM mechanics: Liquidity pooled between tokens on a bonding curve offers minimal control over trade execution and exposes users to slippage.
Lack of awareness: Many users chalk up losses to market volatility, unaware they’ve been exploited.
How do AMMs contribute to the problem?
AMMs inherently expose users to sandwich attacks due to their design:
Slippage: AMMs quote a price before a trade but adjust the price after the trade based on pool dynamics, leaving users vulnerable.
Price determination: The AMM dictates trade prices, not the user.
Liquidity depth: Shallow pools amplify price changes, increasing the risk of manipulation.
These factors make AMMs fertile ground for MEV bots.
What DEXes can I use to avoid MEV Sandwich Attacks?
Due to the inherent risk of sandwich attacks on AMMs, avoid using them to trade when possible. A few existing DEXes offer protection, but one in particular offers immunity. Carbon DeFi, by Bancor, boasts a cutting-edge DEX architecture that removes the vulnerabilities enabling sandwich attacks.
No reliance on liquidity pools: Trades aren’t affected by pool rebalancing, slippage, or depth limitations.
Direct execution: Trades are executed at the exact price makers set, leaving no room for front-running or back-running.
Uses asymmetric liquidity: Each trade uses a single token bonding curve, rather than the multi-token bonding curves that AMMs use, sidestepping their inherent risks.
Encourages trading with maker-driven strategies: Users set their own prices, ensuring full control while eliminating the risk of MEV sandwich attacks when creating orders. They are then filled by “takers” including a de-facto taker, a built-in arbitrage bot. The Arb Fast Lane helps efficiently fill orders by using aggregated chain-wide liquidity, at no additional cost to the user.
Are MEV Sandwich Attacks common in DeFi?
Yes. They are the second most common type of MEV. According to leading MEV researcher EigenPhi, in the last 30 days on Ethereum alone:
Over 72,000 sandwich attacks targeted more than 35,000 victims.
More than $8 million USD was used to extract approximately $1.4 million USD in profits from unsuspecting DeFi users.
Where can I find which contracts are most exploited by sandwich attackers?
EigenPhi’s Sandwich Overview provides detailed data on Ethereum, including:
Top 10 exploited contracts
Summary metrics: transaction count, profit, cost, number of attackers, and victims
Profit distribution analysis
Latest attacks
How can I start trading on Carbon DeFi and avoid sandwich attacks?
Becoming a maker on Carbon DeFi is simple:
Choose an order type: Limit, Range, or Recurring.
Set your desired price or price range.
Deploy your strategy and let Carbon DeFi’s handle the rest.
Want to Learn More?
For a deeper, more technical analysis of MEV sandwich attacks, read the in-depth blog series by Dr. Mark Richardson, Bancor Project Lead, beginning with “The Optimum Sandwich: How to Exploit Blockchain Enthusiasts with Arbitrary Precision”.
For additional information on how to gain immunity from sandwich attacks, see here.