NETConnecting

Docs Protocol

Mainnet replay

Solana mainnet blocks run through Acrux's merge and selection. How each block becomes one Acrux order, how a sandwich is found in it, and how each victim is priced as its trade would land in a leaderless slot.

On Solana one leader orders a block and sees every transaction in it first. The replay takes recorded Solana mainnet blocks and runs them through the merge and selection every Acrux validator runs (Ordering and selection), so the leader's order and Acrux's stand side by side. In each block it finds the sandwiches, a trader's two trades around someone else's, and prices each victim's trade as it would land on Acrux.

WhereHolds
/replaythe replayed range, its totals and every sandwich, each mainnet transaction linked to an explorer
/replay/<slot>one mainnet slot: both orders, its Acrux slots on four tracks, its sandwiches
GET /v1/replay, GET /v1/replay/{slot}the same, as JSON
acrux replayany mainnet block, from a Solana RPC or a saved file, in your terminal

One block, two orders

Each transaction in the block becomes the candidate the node would read from it:

From
Priority per CUits SetComputeUnitPrice instruction, in micro-lamports a compute unit, or a version 1 transaction's priority fee divided over its CU limit; 0 without either
Compute limitits SetComputeUnitLimit instruction or a version 1 transaction's CU limit; without either, 200,000 CU for each instruction that is not Compute Budget, at most 1,400,000
Writable accountsthe keys its header marks writable, less any called as a program, plus the writable addresses of its lookup tables

Vote transactions are left out, as Acrux has none. The rest are sorted and placed by Algorithm 4: four tracks of 2,000,000 CU an Acrux slot, transactions that write the same account one after another on a track. A mainnet block usually asks for more than one Acrux slot holds, so Acrux slot after Acrux slot takes what the one before could not place, until the whole block is placed. Each transaction then has its Acrux slot, counted from 1 for the first slot the block fills, its track and its start.

The replay does not execute the block. The amounts it prices come from what the block itself recorded.

A sandwich

Three successful transactions in one block, in the leader's order:

  1. Front leg. A trader buys asset X with asset Y.
  2. Victim. Another wallet buys the same X with the same Y on the same pool, signing its own trade.
  3. Back leg. The trader sells the same amount of X, within 2% of what the front bought, for more Y than the front spent.

The legs can stand hundreds of positions apart, with other trades on the pool between them. The trader is the owner of the accounts that receive X in the front leg, whoever signs it. The pool is the token accounts, not the trader's, that both legs move, and the victim's trade moves one of them too. What each transaction moved is read from its balances before and after: every owner's tokens, and the signer's lamports with the fee given back, wrapped SOL counted as SOL.

One front and back pair can sandwich several victims; each victim is counted once, in the first sandwich found around it. Not counted:

Why
A pool's own authorityit gains and loses both assets in every trade on its pool; a victim's trade moves its accounts, which never happens to a trader's
A round trip that losesthe sale must bring back more Y than the buy spent
A buy and a sale with no one between them on the poolthere is no victim
Failed and vote transactionsthey move nothing

The victim on Acrux

Each victim is priced two ways, as its trade would be sent on Acrux.

Sent 2-of-3. /send's default (Threshold sends). The trade reaches the slot's proposers as fragments, and no proposer can read it before the slot is agreed (Threshold transactions). There is nothing to build a front leg from, so the front leg is taken out: the victim's output is computed again on the pool as it stood without it. The back leg would remain as a plain trade after the victim. The difference between what the victim would get and what it got is what it lost to the front leg, valued in the asset it paid with, at its own price.

Sent plain, t = 1. The proposer that receives it can read it, and the merge orders by priority per compute unit, so a trade gets in front only by paying more per unit. That costs the victim's priority per CU plus one micro-lamport, over the front leg's compute limit, in lamports, paid in the open. Where the victim paid with SOL, the cost comes off the trader's take.

Pricing the pool

The pool's state comes from the block, so no historical account state is read. Which way a victim is priced depends on what its pool recorded:

PoolHow the victim's output is computed again
Pump.fun bonding curvethe curve's virtual SOL and token reserves from the TradeEvent the program logs after each trade: the victim's reserves before its trade, with the front leg's buy taken back out, give its output for the same SOL
Concentrated liquidity: Meteora DAMM v2, Orca Whirlpool, Raydium CLMMeach program's own swap event (EvtSwap2, Traded, SwapEvent): the input after the fee, the output and the square-root price after the trade give the pool's liquidity and its virtual reserves before the victim's trade; the front leg's trade is taken back out of them and the victim's input runs against what is left. Priced only when the front leg's event reads the same liquidity within 1%, so both trades stayed in one range
Constant-product vaultsthe two vaults the victim's trade moved, read from every trade the block made against them. One fee, taken off the input or off the Y side, has to reproduce every one of those trades within 0.2% on the constant-product rule; then the victim's input runs on the vaults with the front leg's change taken back out
Meteora DLMM, and a vault pair the rule does not reproducenot priced: DLMM's events state only its bins, which do not tell the trade without the front leg

A victim whose pool is not priced is still counted as found; its row carries no repricing.

The totals

GET /v1/replay totals any range of replayed mainnet slots. Two of its totals are in SOL, and /replay shows them side by side:

ReplayRange fieldSums
Taken by traderslamportsTakeneach front and back pair's take once, the legs' transaction fees given back and their tips counted against it, over every sandwich paid in SOL, priced or not
Lost to front legslamportsKepteach priced victim's loss to its front leg, over victims who paid in SOL: what sending 2-of-3 on Acrux keeps them

They measure different things, so they differ. A third wallet that sells X between the legs, at the price the front leg raised, takes part of the victims' loss, which the trader never sees. One pair can sandwich several victims, whose losses add up against one take. And only priced victims count toward the second total, while every SOL sandwich counts toward the first.