← TextbooksSandwiches and per-block clearing: a study guide
Contents

A student trynna learn · study guide

Sandwiches and per-block clearing

Everything you need to explain, and defend, one week of Uniswap sandwich attacks replayed through Chan, Wu & Shi's two-phase mechanism.

Built 2026-10-18 from the study's results and tested code. Toy examples are labelled Illustration. rahil-design 3.x.

Chapter 0

The study on one page

Why you need thisEverything else in this book supports the five sentences below. Read them first, then use the chapters to make each one yours.

  1. In one week (5–11 October 2026) Uniswap v3's WETH/USDT 0.01% pool had 70,669 swaps and 236 sandwich attacks on 244 traders.
  2. The victims lost $12,387 compared with an exact replay of the same block without the attacker.
  3. Where the victim's minimum output could be read, attackers took 98% of the slippage the victim allowed.
  4. Under Ke Wu's per-block two-phase mechanism (Chan, Wu & Shi, AFT 2025), no attack makes money in any run.
  5. With the same orders replayed, victims keep 75% of their loss on average (52%–99% across variants), and about 100% if attackers stop because the attack no longer pays.

Reading map

Chapters 1–4 are the market: blocks, AMMs, Uniswap v3 and the attack itself. Chapters 5–6 are the measurement: how a sandwich is found and how a loss is defined. Chapters 7–9 are the theory you will discuss with Ke Wu. Chapter 10 is the lens for Michael Wellman. Chapter 11 puts the results together and chapter 12 prepares the conversation.

Every toy number in this book comes from the study's own tested code (textbook/toy.py runs mev/v3.py and mev/mechanism.py). Every real number comes from results/. Toy figures carry an Illustration label.

Chapter 1

Blocks, ordering and who sees your trade

Why you need thisA sandwich only works because someone controls the order of transactions inside a block. You need to explain who that is.

A transaction is a signed instruction, for example "swap 20,000 USDC for ETH, and revert if I get less than 8.8 ETH". Ethereum groups transactions into a block every 12 seconds. Inside a block the transactions run one after another, so their order decides what price each swap gets.

Today the order is chosen by a builder. Builders compete to give the block proposer (a validator) the most valuable block. Searchers are bots that watch pending transactions and send the builder a bundle: their own transactions in a fixed order, plus a tip. The tip can be a priority fee or a direct ETH transfer to the builder. Profit that comes from choosing, inserting or reordering transactions is called MEV (maximal extractable value). A sandwich is one kind of MEV.

A transaction sent to the public mempool is visible to every searcher before it is mined. A transaction sent through a private RPC goes only to selected builders. Private flow is one reason some big pools see few sandwiches. The fee tier is another: on 7 October the 0.01% USDC/WETH and WETH/USDT pools were each sandwiched about 40 times, while their 0.05% pools were sandwiched 2–3 times.

Walletsigns a swapPublic mempoolanyone can seePrivate RPChidden until minedSearcher botsandwich, arbitrageBuilderorders the blockProposerpublishesbroadcastsend privatelysees txbundle + tiptxbest blockBlock order (one bundle)front-runvictimback-run

Scroll sideways to see the whole figure.

A swap from the public mempool can be seen by a searcher. The searcher pays the builder to put its front-run and back-run on each side of the swap in the same block.

In this study: 236 sandwiches, mostly built by Titan, BuilderNet, Quasar and Eureka. The top attacker, jaredfromsubway.eth, ran 96 of them. Attackers paid at least $4,400 in fees, 50% of what they took from the pool. Etherscan also shows direct ETH tips to builders, which receipts do not show.

Say it in one breathEthereum runs a block's transactions in order, and builders choose that order, so whoever pays the builder can put trades on both sides of yours.

Check yourself

  1. Why can the attacker be sure its back-run comes right after the victim?

    It sends the front-run, the victim's transaction and the back-run to the builder as one bundle with a fixed order. The builder includes the bundle as a unit or not at all.

  2. Why might a big pool show almost no sandwiches?

    Much of its order flow is private, and a higher fee tier makes both attack legs more expensive. The USDC/WETH 0.05% pool had 13 sandwiches in the week; the 0.01% pools of the same pairs had about 40 a day.

  3. What does an attacker's gas figure miss?

    Direct ETH transfers to the builder inside the transaction (for example 0.251 ETH to Titan Builder in block 26,164,108). Those need traces, so the study's gas number is a lower bound on what attackers paid.

Chapter 2

Automated market makers

Why you need thisThe price impact of a trade is what the attacker exploits. You need to compute it in your head for a simple pool.

An automated market maker (AMM) is a contract that holds two tokens and trades against anyone. The simplest rule is constant product: if the pool holds x ETH and y USDC, every trade must keep x × y = k.

The price is the slope of the curve, y ÷ x USDC per ETH. A buy of ETH adds USDC and removes ETH, so the price rises during the trade. The buyer pays an average price above the starting price. The gap is the price impact, or slippage. A fee (0.01% on the study pool) is charged on the input.

Illustration
Before: 100 ETH, 200,000 USDCprice 2,000 USDC per ETHAfter: 90.91 ETH, 220,000 USDCprice 2,420; buyer got 9.09 ETHETH in the pool (60 to 140)USDCx × y = 20,000,000

Scroll sideways to see the whole figure.

The toy pool: 100 ETH and 200,000 USDC, no fee. Paying 20,000 USDC returns 9.0909 ETH, an average of 2,200 USDC per ETH. The price after the trade is 2,420.

Two prices matter in this study. The average price is what one trade paid overall. The marginal price is the price of the next tiny unit, the slope at the end of the trade. Uniswap users protect themselves with an average price (a minimum output). Ke Wu's mechanism uses a marginal price. Chapter 8 shows why that difference matters.

Say it in one breathIn a constant-product pool your own trade moves the price against you, so anyone who trades in front of you in the same direction makes your price worse.

Check yourself

  1. In the toy pool, what does 20,000 USDC buy, and why not 10 ETH?

    9.0909 ETH. Each ETH removed makes the next one more expensive: the price climbs from 2,000 to 2,420 during the trade.

  2. What is the difference between average and marginal price?

    Average: total paid divided by total received for one trade. Marginal: the price of the next unit at a given pool state, the slope of the curve.

  3. Why is the price impact larger in a smaller pool?

    The same trade is a bigger fraction of the reserves, so the product rule forces a larger price move.

Chapter 3

Uniswap v3: concentrated liquidity

Why you need thisThe study replays every swap with Uniswap v3's exact integer math. You need to say what that math tracks and why exact replay is the gate.

In Uniswap v3, liquidity providers put money in a chosen price range. Inside a range the pool behaves like a constant-product pool with that much liquidity. Ranges are built from ticks: each tick is a 0.01% price step. When a swap moves the price across a range boundary, the active liquidity changes and the price can move faster or slower.

The contract stores the price as sqrtPriceX96: the square root of the price, times 296, as an integer. Every Swap event records the price, active liquidity and tick after the swap. That is why the study can rebuild the pool state from logs alone.

Illustration
current pricea buy pushes price righttick boundary: liquidity drops, price moves fasterlower price ← price, in ticks of 0.01% each → higher priceactive liquidity

Scroll sideways to see the whole figure.

Liquidity is stacked in price ranges. A buy pushes the price right; at a range boundary the active liquidity drops and the price moves faster.

The replay gate. The study ported Uniswap's integer math to Python and replayed all 70,669 swaps of the week. Every one matched exactly: the amounts and the price, liquidity and tick afterwards. Three broken inputs make it fail, which shows the check can catch errors: a wrong fee breaks 70,645 swaps, dropping 20 ticks breaks 1,284, and ignoring the 129 liquidity changes breaks 334.

Just-in-time (JIT) liquidity. A bot can add liquidity in a narrow range right before a big swap and remove it right after, collecting the fee. In 37 of the 236 sandwiches the attacker did this inside the attack. Chapter 4 shows how.

Say it in one breathUniswap v3 is a stack of constant-product pools over price ranges; the study reproduces every swap of the week to the last unit before it trusts any what-if.

Check yourself

  1. Why replay every real swap before computing any counterfactual?

    If the simulator matches reality exactly on 70,669 swaps, a difference in the counterfactual comes from the change you made (removing the attacker), not from a simulator error.

  2. What does a tick crossing change?

    The active liquidity. Liquidity providers whose range starts or ends at that tick join or leave.

  3. Why do negative controls matter?

    A gate that never fails proves nothing. Breaking the fee, the tick data or the liquidity events makes it fail, so it really checks the inputs.

Chapter 4

The sandwich attack

Why you need thisThis is the problem the paper solves. You need the mechanics, and the reason the minimum output is the attacker's budget.

The victim sends "buy ETH with 20,000 USDC, at least 8.8 ETH". An attacker sees it and puts three transactions in order:

  1. Front-run: buy ETH first, pushing the price up.
  2. Victim: buys at the higher price and gets less ETH.
  3. Back-run: sell the ETH from step 1 at the even higher price.
Illustration
2,0002,2002,400no attack: victim alone ends at 2,420start2,000front-run buys 1.69 ETH2,069victim buys2,496back-run sells 1.69 ETH2,405USDC/ETH

Scroll sideways to see the whole figure.

The toy sandwich. The front-run spends 3,435.11 USDC. The victim gets exactly its minimum, 8.80 ETH instead of 9.09. The back-run returns 4,136.86 USDC, a profit of 701.75 USDC.

The minimum output is the budget. The attacker makes the front-run as large as possible while the victim's swap still succeeds. In the toy, a larger front-run would push the victim below 8.8 ETH and the victim's transaction would revert, ending the attack. So the attacker uses all of the victim's tolerance. The real data shows the same: attackers took 98% of the tolerance victims allowed. Victims with no minimum at all (29 decoded cases) can lose almost everything. One wallet put 0.447 WETH into the pool and got 3.89 USDT back.

The JIT variant. jaredfromsubway's front-run sometimes also adds liquidity in the single tick where the victim will trade, and the back-run removes it. The victim then trades at the pushed price against the attacker's own liquidity.

Say it in one breathThe attacker buys in front of you, lets you buy at the higher price, then sells back, and it sizes the front-run to push you exactly to your minimum.

Check yourself

  1. Why doesn't the attacker use an even bigger front-run?

    The victim's transaction would fall below its minimum output and revert. The back-run would then sell into a market the victim never pushed up.

  2. Why does setting a tight slippage limit protect you?

    It shrinks the attacker's budget. A 0.1% tolerance leaves almost nothing to take after fees and gas.

  3. What is the attacker's profit made of?

    The price difference between the front-run's buy and the back-run's sell, which the victim's trade created.

Chapter 5

Finding sandwiches in the data

Why you need thisA professor's first question will be how you know these are sandwiches. You need the rule, its tiers and how it was checked.

The detector reads each block's swaps on the pool in log order. It merges each transaction into one leg and looks for this pattern:

  • a front-run and a back-run in the same block, front-run first, in opposite directions;
  • the same attacker: the same sending address, or the same bot contract with amounts within ±1%;
  • the back-run sells 90–110% of what the front-run bought (the rule from Qin, Zhou & Gervais, S&P 2022);
  • at least one victim between them, trading in the front-run's direction, from a different sender and contract.
Illustration
position 0: arbitrage bot, sells ETHposition 1: bot 0x1f2f…, buys ETHposition 2: Universal Router, buys ETHposition 3: bot 0x1f2f…, sells ETHposition 4: 1inch router, sells ETHsame sender, opposite directionsback-run sells 90–110% of what the front-run boughtvictim between them, same direction as the front-run,different sender and contractpositions 0 and 4 play no role

Scroll sideways to see the whole figure.

One block's swaps on the pool, in order. Positions 1 and 3 are the attacker's legs; position 2 is the victim.
Detection tierSandwichesVictim loss
All detected (90–110% amount match)236$12,387
Strict amount match (±1%)193$10,428
Strict, single-pool front-run, same sender178$10,043

How it was checked. The evidence for 30 random hits was read row by row: each leg's full receipt, how many senders use each contract, and ENS names resolved on chain. 25 were textbook sandwiches, 3 were losing attempts, and 2 had front-runs that also traded in other pools. Then 15 Etherscan pages were read for 5 hits. All 5 are sandwiches, and the attacker contracts carry Etherscan's "MEV Bot" tags. The check also found the JIT pattern.

Dune's rule, re-implemented. Dune's public spellbook rule (same sender, no amount check) was run locally on the same logs. It confirms 235 of the 236 sandwich blocks and flags 20 more, all with back-run amounts outside the 90–110% window. So the headline count is conservative. No Dune account was used.

What it misses: sandwiches that span two blocks or several pools, and attacks on private flow whose cause cannot be seen.

Say it in one breathA sandwich is the same attacker trading both ways in one block around a victim, with the back-run undoing the front-run, and the result holds in its strictest tier.

Check yourself

  1. Why require the back-run to sell 90–110% of what the front-run bought?

    It separates an attacker closing its position from two unrelated trades by a bot that trades both ways all day.

  2. Why report three tiers?

    So the headline doesn't depend on one threshold. The strictest tier still has 178 sandwiches and $10,043 of loss.

  3. Name one kind of attack the detector cannot see.

    A sandwich whose legs are in different blocks, or one that front-runs through another pool.

Chapter 6

Measuring loss: the counterfactual

Why you need this“Loss” needs a definition someone can check. You need to say what is compared with what.

(a) Counterfactual loss, the headline. Take the pool state at the start of the block. Replay the block exactly, with every attacker swap and attacker liquidity change removed. The victim's loss is what it would have received in that replay minus what it actually received.

Illustration
Actual blockfront-runvictimback-runvictim gets 8.8000 ETHReplay without the attackervictimvictim gets 9.0909 ETHloss (a) = 0.2909 ETH(c) tolerance = 9.09 − minimum 8.8 = 0.2909 ETH; the attack used all of it

Scroll sideways to see the whole figure.

Loss (a) in the toy: 0.2909 ETH. Loss (c), the tolerance, equals the loss here because the attacker pushed the victim exactly to its minimum.

(b) Attacker gross. Every WETH and USDT transfer between the pool and the attacker's two transactions: $8,713 for the week, before $4,400 of gas.

(c) Tolerance available. The no-attack output minus the victim's own minimum output, read from the router call. Defined for 115 victims: $1,582 of tolerance, of which attackers took $1,544 (98%).

Values are in USD at the price at the start of the block, with USDT taken as $1. The median victim lost $14.14; the 20 largest sandwiches carry 64% of the week's loss.

Say it in one breathLoss is the difference between the victim's real output and an exact replay of the same block without the attacker.

Check yourself

  1. Why is (b) not equal to (a)?

    The attacker's gain and the victim's loss are measured against different baselines, and some value goes to fees and liquidity providers. Here (b) was $8,713 and (a) was $12,387.

  2. Why remove the attacker's liquidity changes too?

    A world without the attack has no JIT liquidity either. Keeping it would cushion the victim and understate the loss.

  3. What does 98% of tolerance tell you?

    Attackers size the front-run to the victim's limit. The limit, not the trade size, sets how much a victim can lose.

Chapter 7

Mechanism-design vocabulary

Why you need thisKe Wu's paper is written in this language. You need these four terms to read it and discuss it.

  • Order: (type, amount v, limit rate r). For example, buy up to v ETH, paying at most r USDC per ETH.
  • Arbitrage resilience: no group of orders can end with a gain in one token and no loss in the other. That is, no risk-free profit, even for a block producer who inserts, drops or reorders orders (Definition 2, Theorem 3.1).
  • Incentive compatibility (IC): reporting your true order is your best strategy; no lie, split, delay or fake order makes you better off (Definition 3). IC implies arbitrage resilience.
  • Plain model and weak fair-sequencing model: what a strategic player can do to the order of transactions.
Plain model (Ethereum today)Weak fair-sequencing model• block producer picks the order• can insert its own orders• can drop others' orders• sees every order first• order fixed by arrival time• can insert orders, but only later• cannot drop others' orders• can still see orders and race themmechanism gives: arbitrage resiliencemechanism gives: full incentive compatibility

Scroll sideways to see the whole figure.

The two models differ in who controls ordering. The mechanism is arbitrage-resilient in both, and fully incentive compatible only with fair sequencing.

The paper compares outcomes with a partial ordering, not a single utility number: an outcome is better if you get more of what you wanted at a price within your limit. Some outcomes are not comparable, for example getting more ETH than you asked for.

Say it in one breathArbitrage resilience means nobody can make risk-free profit from the batch; incentive compatibility is the stronger claim that honesty is your best strategy, and it needs fair sequencing.

Check yourself

  1. Is a sandwich an arbitrage in the paper's sense?

    Yes. The attacker ends with no net ETH and more USDC, a risk-free gain, which arbitrage resilience forbids.

  2. Why does IC need the fair-sequencing model?

    In the plain model, ties are broken by arrival time, and a block producer can fake an early arrival to get a better place. Fair sequencing removes that move.

  3. Which property did the study test numerically?

    Arbitrage resilience: in every run the attacker's two legs net to zero or less.

Chapter 8

The Chan–Wu–Shi two-phase mechanism

Why you need thisThis is the design the email is about. You need to run it by hand on a small block.

The mechanism clears all of one block's orders for one pool together (Figure 1 of the paper):

  1. Fix r0, the pool's marginal price at the start of the block. Drop any order whose limit is worse than r0.
  2. Measure each order's size in ETH at r0. The side with more volume is dominant; the other is the minority.
  3. Phase 1: fill the whole minority side at r0 against the dominant side, in tie-break order. The pool does not move.
  4. Phase 2: the rest of the dominant side trades on the curve one order at a time, each until it is filled or the marginal price reaches its limit.
Illustration
Buy ETHdominant sideSell ETHminority sidefront-run 1.72victim 10.00back-run 1.69phase 1at r0phase 2: 10.03 ETH on the curve, one order at a timeall 1.69 ETH sold at r0 = 2,000; the pool does not moveSizes in ETH at the start-of-block price r0. Orders whose limit is worse than r0 are dropped before this step.Front-run first in tie-break order; attacker legs have no limit.

Scroll sideways to see the whole figure.

The toy block, front-run first. Phase 1 matches the back-run's sell against the front-run at r0, so the front-run hardly moves the pool before the victim trades.

Why the sandwich fails. In phase 1 everything trades at r0. In phase 2 only the dominant side trades, and each order pays r0 or worse. So the attacker's buy pays at least r0 and its sell gets at most r0. It cannot end with a risk-free gain. That is Theorem 3.1, and the study's code checks it in every run.

Illustration
8.68.89.09.29.4ETH the victim receives (axis starts at 8.6)victim, ETHattacker, USDCNo attack9.09Continuous: sandwiched8.80+701.75Mechanism, front-run first9.09-0.02Mechanism, victim first9.36-552.68Mechanism, attacker legs limited8.94-14.50

Scroll sideways to see the whole figure.

Five versions of the toy block. The sandwich leaves the victim 8.80 ETH and the attacker +701.75 USDC. Under the mechanism the attacker never gains. With the victim first, the victim gets more than with no attack, because phase 1 hands it the back-run's ETH at r0.

Why the real result is 52–99%, not 100%

The mechanism removes the profit. It does not stop a trade placed ahead of the victim from moving the price in phase 2. The study gave each attacker leg its own executed price as a limit, a price the attacker is known to accept. Then:

  • The back-run's limit is worse than r0, so step 1 drops it.
  • The front-run trades on the curve until the marginal price reaches its own average price, about half its size.
  • The victim, behind it, still pays for that half.

In the toy this recovers 50% of the victim's loss; in the real week, 52%. Random tie-breaking puts the victim first about half the time, giving 75% on average. If the attack stops because it no longer pays, the victim keeps about 100%.

Average limits against marginal limits

Uniswap users state an average limit (a minimum output). The paper's limit is marginal. Reading the toy victim's minimum (8.8 ETH for 20,000 USDC) as a marginal limit fills only 83% of its order, because its own trade pushes the marginal price past 2,273 USDC per ETH. That is the question the email to Ke Wu asks.

Say it in one breathMatch buys against sells at the start-of-block price, then run the leftover one-sided flow along the curve; the attacker's two legs can only trade at r0 or worse, so the sandwich has no profit left.

Check yourself

  1. In phase 1, does the pool's price change?

    No. Buyers and sellers trade with each other at r0, and the pool's reserves are untouched.

  2. Why can't the back-run sell above r0?

    The sell side is the minority, so it trades only in phase 1, at exactly r0. Only the dominant side trades along the curve.

  3. Why does the study report a range, not one prevented share?

    The result depends on how the attacker's orders would look under the mechanism (limits, ordering) and whether the attacker attacks at all. The range shows that dependence.

  4. Is this a uniform-price batch auction?

    No. Phase 2 orders pay different prices. The paper says uniform pricing alone does not give incentive compatibility, and the Trilemma paper proves you cannot have both with weak local efficiency.

Chapter 9

The Trilemma

Why you need thisThe follow-up paper (Li, Shi & Zhang, 2026) tells you what the mechanism had to give up. It is the natural next question in a meeting.

  • IC: incentive compatibility (chapter 7).
  • wLE, weak local efficiency: no "reasonable" order (limit at least as good as r0) is left unfilled when the pool's ending price would still have suited it.
  • UP, uniform pricing: every executed order trades at the same price.
ICwLEUPChan–Wu–Shi(fair sequencing)Li–Shi–Zhang Mechanism 1(very inefficient)uniform-price batch clearing(not incentive compatible)

Scroll sideways to see the whole figure.

Theorem 2 of Li, Shi & Zhang: any two properties are possible, all three are not. Chan–Wu–Shi gives up uniform pricing.

A uniform-price batch auction (CoW-style) gets wLE and UP, but the paper shows a user with real demand can gain by misreporting. So it is not IC. Uniform pricing removes the pure sandwich, but not every strategic gain.

The trilemma paper also notes the cost of the drop rule in step 1: an order to buy below r0 is ignored even if the pool's ending price would have suited it. In the study, the smallest victim fill in the arrival-order run was 83%.

Say it in one breathYou can have any two of honesty-is-optimal, no wasted reasonable demand, and one price for everyone, but not all three; Ke Wu's mechanism keeps the first two.

Check yourself

  1. Which property does Chan–Wu–Shi give up?

    Uniform pricing.

  2. Why isn't a uniform-price batch auction enough?

    It stops zero-demand arbitrage like sandwiches, but a trader with real demand can still gain by misreporting, so it is not incentive compatible.

  3. What is the main open question both papers leave?

    Achieving IC with weak local efficiency in the plain model, without assuming fair sequencing.

Chapter 10

Wellman's lens: batch against continuous

Why you need thisWellman has no blockchain papers. The connection is his work on how market rules change strategic behavior.

In a continuous market each order trades on arrival, so being first is worth money. Wah & Wellman (2016) simulate fragmented stock markets and find that frequent call markets, which collect orders and clear them together at intervals, eliminate latency arbitrage. A block is a natural batch interval.

Continuous: each order trades on arrivalwho arrives a microsecond earlier trades first; ordering is worth moneyBatch (call market, or one block): collect, then clear togetherinside one batch, arriving earlier does not get a better price

Scroll sideways to see the whole figure.

The same arrivals under continuous trading and under batches. Inside a batch, arriving first no longer buys a better price.

Empirical game-theoretic analysis (EGTA) is Wellman's main method. Simulate a market with many strategies, estimate the payoff of each combination, and find the equilibrium among them. The study's biggest limit is exactly an EGTA question: it replays the same orders and cannot say how bots, builders and traders would change their behavior under the new rule.

Say it in one breathContinuous trading pays whoever is first; batching removes that prize, and how traders re-optimize under the new rule is an empirical game.

Check yourself

  1. What does a frequent call market remove, according to Wah & Wellman?

    Latency arbitrage: profit from reacting to information or orders faster than others.

  2. Why is the 52–100% range an EGTA question?

    The range depends on what attackers do once the attack stops paying. Working that out means finding the equilibrium of the new game, which is what EGTA does.

Chapter 11

What the study found, and how to say it

Why you need thisThis is the paragraph you will say most often. Learn it with its limits attached.

Per-block clearing cuts the week's $12,387 sandwich loss to $3,041 with the same orders

$0$4k$8k$12k050100150200sandwiches, ranked by victim loss (n = 236)Status quo $12,387Same orders,per-block clearing $3,041Attackers stop ≈ $0

Scroll sideways to see the whole figure.

Real data, 5–11 Oct 2026. Same orders under per-block clearing: mean of 200 random tie-breaks. The 20 largest sandwiches carry 64% of the loss.
MeasureValue
Swaps / sandwiches / victims70,669 / 236 / 244
Victim loss (a)$12,387
Attacker gross (b) / gas$8,713 / $4,400
Tolerance taken (c), 115 victims98%
Attacker net under the mechanism, best run$0.00
Loss kept by victims: deterred100%
Same orders, random tie-break (5th–95th percentile)75% (68%–84%)
Same orders, arrival order (lowest variant)52%
Control pool USDC/WETH 0.05%, same week13 sandwiches
Dune's rule (local) confirms our sandwich blocks99.6%
Memecoin pool SIMD/WETH 0.01%: sandwiches / loss / kept with same orders240 / $1,330 / 73%

The memecoin pool (created on 6 October) has as many sandwiches but one-ninth the loss, and 95% of that loss is one automated buyer that kept trading with loose slippage. The mechanism's effect is almost the same in both pools.

The paragraph

"One week of Uniswap v3's busiest WETH/USDT pool, 70,669 swaps, replayed with exact integer math: 236 sandwiches cost 244 traders $12.4k, and attackers took 98% of the slippage those traders allowed. Under your two-phase mechanism none of those attacks makes money. With the same orders, victims keep 75% of their loss on average, and all of it if attackers stop."

Describe your own role accurately when you say this, including the AI assistance in building the study.

Limits to say with it

  • One pool and one week: a sample, not a yearly rate.
  • Same order flow: behavior under the new rule is not modeled.
  • Same-block, single-pool detection only; builder tips by direct transfer are not counted.
  • Average limits read as marginal limits, which sets the lower bound.
  • The paper's model has no fee and no liquidity changes inside a block; the study applies them at the block start.

Say it in one breath236 sandwiches, $12.4k lost, 98% of tolerance taken; under the mechanism no attack pays, and victims keep 75% with the same orders and all of it if attacks stop.

Chapter 12

Meeting prep

Why you need thisPractise these out loud. Each answer is short and true to the data.

Why this pool?

It is the busiest WETH/USDT pool and was the only regularly sandwiched pool in the first nine-pool scan. A later all-pool scan showed that list missed USDC/WETH 0.01%, which is busier and sandwiched about as often, so the fair claim is “the busiest WETH/USDT pool”. The pattern is the 0.01% fee tier.

Does it hold outside blue chips?

On the most-sandwiched memecoin pool that week (SIMD/WETH 0.01%): 240 sandwiches, $1,330 lost, 95% of it by one automated buyer, and victims keep 73% under the mechanism on average. Same mechanism effect, much smaller dollars.

How do you know they are sandwiches?

A published rule, three robustness tiers, evidence for 30 random hits, and 5 hits checked on Etherscan. All held up; the strictest tier still has 178 sandwiches.

Isn't “attacker net ≤ 0” just your Theorem 3.1?

Yes, and it checks the implementation rather than adding a new result. The new parts are the victim numbers, the 98% tolerance finding and the range of protection on real order flow.

Why not 100% with the same orders?

Phase 2 still lets an order ahead of the victim move the price. With the attacker's executed prices as limits the back-run is dropped and half the front-run still trades. Random tie-breaking raises the share to 75%.

How did you treat Uniswap's average-price limits?

As marginal limits. That under-fills orders and sets the lower bound. A version of the mechanism for average-price limits is the open question I'd like to ask about.

What about fees?

Phase 2 keeps the 0.01% pool fee. Phase 1 was run with and without it; the result is the same to the reported precision.

Concentrated liquidity?

v3 is constant-product within each range, and the price still rises with each unit bought (increasing marginal cost), which the proofs need. JIT liquidity inside a block is outside the paper's model.

What would you do next?

More weeks and pools; multi-pool and cross-block sandwiches; an empirical game of attacker and builder responses; and mechanisms for average-price limits.

Before you send anything: read the figure at full size, check both email addresses, and keep the claims to what the tables show.

Reference

Glossary and reading list

AMM
Automated market maker: a contract that holds two tokens and trades against anyone by a fixed rule.
Arbitrage resilience
No group of orders can make a risk-free profit from the mechanism.
Average price
Total paid ÷ total received for one trade.
Back-run
The attacker's trade right after the victim, closing its position.
Builder
The party that orders transactions into a block to sell to the proposer.
Counterfactual
An exact replay of the block with something changed, here the attacker removed.
EGTA
Empirical game-theoretic analysis: estimate a game's payoffs by simulation and solve it.
Front-run
The attacker's trade right before the victim, in the same direction.
IC
Incentive compatibility: truthful reporting is the best strategy.
JIT liquidity
Liquidity added just before a swap and removed just after.
Marginal price
The price of the next tiny unit; the slope of the curve.
MEV
Maximal extractable value: profit from choosing, inserting or reordering transactions in a block.
Minimum output
The least a swap accepts; below it the transaction reverts.
r0
The pool's marginal price at the start of the block.
sqrtPriceX96
Uniswap v3's stored price: √price × 2⁹⁶, an integer.
Tick
A 0.01% price step; liquidity ranges start and end on ticks.
UP
Uniform pricing: every executed order trades at one price.
wLE
Weak local efficiency: no reasonable order is left unfilled when the ending price still suits it.

Read next

Sources: the study repository (docs/methods.md, results/), and the papers in the reading list. Toy numbers: textbook/toy.py. Nothing here has been published.