Lesson 0112 min
MEMPOOL · ORDERING · STATE

Who Can See a Trade Before It Executes?

Follow a swap from wallet to public or private flow to a block, separating intent, pending content, and shared executed state.

ObjectivesAfter this lesson, you should be able to:
  • Separate a signed intent, a pending transaction, and an executed block
  • Explain why ordering changes the next quote
  • Identify when a searcher gains usable information
COURSE POSITIONStep 1 of 4
  1. PREVIOUSCourse introduction
  2. CURRENTWho Can See a Trade Before It Executes?

    Follow a swap from wallet to public or private flow to a block, separating intent, pending content, and shared executed state.

  3. NEXTWhat Does a Sandwich Searcher Extract?
BEFORE YOU READ

Think about these questions first.

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

Q01How can others use a transaction before it is onchain?
SHORT ANSWER

The public mempool broadcasts pending intent. Searchers simulate how it will change state, submit surrounding transactions, and compete to place them in the same block.

Compared with your prediction:

A signed transaction is not immediately a fact every node agrees on. It can enter a public mempool, be observed and reordered by a searcher or builder, and only change balances and pool reserves when a block executes it.

Pending is not executed

“Submitted” in a wallet, pending in a node, and executed in a block are three different states. A public mempool is a waiting room: it reveals intent to other participants without promising the final order.

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.

ScenarioPublic mempoolPhase: idle
Pool spot price120.00credits / TOKEN
User quote90TOKEN
User actual output0TOKEN
Searcher P/L0credits, after tip
Visible to searcherNO0 mempool item(s)
From intent to shared statePublic mempool
  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 starts with a user swapping 12,000 credits for TOKEN. Submit it to the mempool and watch the quote appear while reserves stay unchanged; only after a block order is built and executed does the state settle.

Expand: how this step works
wallet signs transaction
  → public/private pending flow
  → builder chooses an order
  → proposer publishes a block
  → every node replays the same state transition

A public mempool is not the consensus layer; private order flow is not the absence of ordering power. A sound design names visibility, cancellation/replacement, censorship, and execution boundaries separately.

KNOWLEDGE CHECK

Why has a pending transaction not become shared state yet?

The audit question left behind

When you see an “MEV profit” number, ask three things: who saw what, who chose the order, and which execution moved the asset. Keep those boundaries separate before moving to sandwiches and back-runs.

LESSON RECAPComplete the exercise and knowledge check first