Lesson 0313 min
BACKRUN · ARBITRAGE · PRICE GAP

Who Back-runs the Price Gap a User Creates?

Let a user swap move the pool, then let a searcher back-run the new price and put inventory and tips on one ledger.

ObjectivesAfter this lesson, you should be able to:
  • Explain why a back-run depends on an earlier state change
  • Compare pool price, external reference, and searcher inventory
  • Show why arbitrage profit is not minted from nowhere
COURSE POSITIONStep 3 of 4
  1. PREVIOUSWhat Does a Sandwich Searcher Extract?
  2. CURRENTWho Back-runs the Price Gap a User Creates?

    Let a user swap move the pool, then let a searcher back-run the new price and put inventory and tips on one ledger.

  3. NEXTDoes Hiding a Trade Make Ordering Fair?
BEFORE YOU READ

Think about these questions first.

Choose an answer before opening the explanation. You can add anything unexpected to your review list.

Q01A backrun repairs price. Why call it value extraction?
SHORT ANSWER

It can improve the next price while allocating the temporary gap created by the user to searchers and proposers. System usefulness and fair distribution are separate questions.

Compared with your prediction:

A large user swap can push the pool price away from an outside reference. A back-runner does not need to beat the user; it only needs to execute after the user, against the reserves that have already changed.

Where does the gap come from?

When the user buys TOKEN with credits, the pool holds less TOKEN and more credits, so its price rises. That state can temporarily diverge from another market. The searcher sells TOKEN after the user in the same block and captures part of the gap created by the new state.

ORDERING SIMULATIONVirtual pool · no real MEV
SECURITY 001 · MEMPOOL / ORDERING / MEV

Who gets to choose the order?

Put one swap into a deterministic pool, then watch visibility, ordering, slippage protection, and extraction change the result.

ScenarioBack-runPhase: idle
Pool spot price120.00credits / TOKEN
User quote90TOKEN
User actual output0TOKEN
Searcher P/L0credits, after tip
Visible to searcherNO0 mempool item(s)
FOCUS EXPERIMENT · BACKRUNWho captures the post-trade gap?

Compare the pool state before and after a user trade, then inspect the back-run inventory ledger.

Baseline quote 90 TOKENMin output 84 TOKENExtraction 0 TOKEN
From intent to shared stateBack-run
  1. 01
    Mempoolintent is visible
  2. 02
    Block orderwho goes first
  3. 03
    Statereplayed by nodes
Mempool
Nothing submitted yet
Selected block order
Build a block after scanning

A mempool record is not a fill. The block order is not a payout. Only execution moves balances and pool reserves.

BALANCE LEDGER · NO VALUE FROM NOWHEREWho gained, who paid, and what moved?

Searcher profit, proposer tip, pool fees, and user output live on the same ledger.

Pool120,000 credits · 1,000 TOKEN
User30,000 credits · 200 TOKEN
Searcher20,000 credits · 200 TOKEN
Proposer0 credits · 0 TOKEN
Coach

Submit one user swap first. The key question is not whether the transaction is valid, but who can see and order it before it becomes shared state.

Ordering events1 EVENTS
  1. 01

    Public pool created: 120,000 credits + 1,000 TOKEN, any public transaction can change the next quote.

ACTION HISTORYExperiment timeline
1 state snapshots

Use the slider to return to an earlier step. Continuing from there replaces the later history with a new sequence.

Initial state
View experiment records →

The lab keeps the searcher's starting TOKEN and credits, pool reserves, searcher P/L, and proposer tip on one ledger. A back-run does not create TOKEN; it moves inventory and price again.

Expand: how this step works
poolPrice_before = pool.quote()
execute(victim)
poolPrice_after = pool.quote()
if poolPrice_after != externalReference:
    execute(searcher_backrun)
    pay(ordering_tip)

Real strategies can span pools, use flash liquidity, or combine with liquidations. This teaching model keeps one pool and one deterministic order so the dependency and asset flow stay visible.

KNOWLEDGE CHECK

Why does a back-run depend on the user executing first?

Put the proposer on the ledger

Ordering power has a price. In this lab the searcher pays an explicit tip to the proposer; real systems can use bundles, gas, builder auctions, and other payment paths. Ask who pays, who receives, and who can reject or reorder the block.

LESSON RECAPComplete the exercise and knowledge check first