Solana shred feeds for arbitrage
A measured latency budget for detecting a Solana price dislocation in shreds, deciding whether it survives costs, and submitting the next transaction.
Where the milliseconds go
6 stages decide the race
Arbitrage starts with a price difference and ends only when all legs settle. A raw shred feed moves detection closer to block production. It does not remove execution risk, state contention, fees, or the chance that another transaction changes a pool before the response lands.
Every Frankfurt datagram reaches the arbitrage box at its registered address through a designated UDP socket. No published standalone raw-feed price undercuts the desk's $100 payment for a 30-day term. The desk judges that fixed input cost against realized opportunities rather than traffic volume.
The useful comparison is not raw shreds against a perfect state oracle. It is raw shreds against the first alternative source that can tell the desk enough to act. A websocket account update, parsed transaction stream, or RPC block notification arrives after more assembly and processing. The value of removing those stages depends on whether the remaining route can fit inside the opportunity lifetime.
The observed swap has entered production
There is no public Solana queue exposing every pending swap. A trade found in shred data is not waiting for initial inclusion: its leader has begun broadcasting candidate-block fragments. The arbitrage leg therefore seeks execution later in the sequence, often during a subsequent slot.
That distinction changes the model. Ethereum-style pending-transaction logic asks what will happen if a visible transaction executes. Shred logic asks what state the current leader appears to have produced, whether that state will survive, and what transaction should reach a leader still able to accept it. This signal observes on-chain production early; it does not reveal private intent in advance.
A cross-venue route may combine a Solana pool with a centralized exchange order book. The external leg can move while the Solana leg waits. A Solana-only route may touch two or three automated market makers and compete for the same accounts as other searchers. Both cases require an explicit freshness bound.
Fields that earn their place
The slot is the first partition key. State from two forks must never enter one price calculation without a policy labeling uncertainty. Shred index supplies within-slot order and progress. FEC-set index confines repair and reassembly to the smallest useful group. A full-slot wait would surrender the timing advantage.
The data or coding variant separates content from recovery material. Data shreds enter the immediate decode path. Coding shreds remain useful because a missing data shred may block an entry that contains the pool update. Completion flags identify useful boundaries, but they do not certify finality.
Authenticate the producer with the leader signature. Because verification has a cost, the desk can run it in a parallel lane after cheap structural checks. Skipping it entirely turns malformed or spoofed input into trading state. Reject invalid sizes and impossible indexes before expensive work, then refuse content that has not met desk policy.
At the transaction layer, account keys and instruction data matter more than a fully formatted transaction object. The matcher needs program IDs, pool and vault accounts, direction, amount, and any instruction fields that change the invariant. Signatures are useful for deduplication and later reconciliation. Log strings are usually unavailable until execution context is reconstructed and are often too late or too costly for the first filter.
Price every millisecond in the route
The arbitrage desk spends 1.95 to 16.8 milliseconds across its pre-landing stages. That target applies to controlled infrastructure, not the public internet. Landing adds a wider 50 to 450 millisecond interval because slot position, leader timing, queue placement, account contention, compute ceilings, and transaction validity dominate it.
Detection below one millisecond is credible when it means classification, not full semantic decode. A batch receive call can timestamp multiple datagrams and place references into per-slot queues. A compact account-key prefilter can reject most entries. Copying every packet, allocating one object per shred, and logging on the hot thread will consume the budget before strategy code runs.
Decode time depends on boundaries. One shred may mix transaction fragments, and a transaction may continue into later shreds. The lower bound assumes all necessary data is present. The upper target allows limited erasure recovery or short reordering, never a long slot-completion wait. Record separate histograms for clean and recovered decode.
Decision time stays small because the route graph is prepared before the signal. The desk keeps pool parameters, fees, token decimals, address lookup data, and transaction templates in memory. The event invalidates a small set of edges. A full graph search, remote database call, or RPC read belongs outside this budget.
Signing is rarely the largest local stage. A local Ed25519 signature can fit below a fraction of a millisecond on ordinary server hardware, but a network hardware security module will not. A remote signer can add several milliseconds and tail spikes. Security policy may require that trade, and the latency budget should show it rather than hide it.
Submission measures application send to acknowledgement or a local send milestone, not landing. A prepared connection avoids DNS, TLS, and session setup on the critical path. Direct leader paths change with the schedule. Relay paths add their own queues and policies. The Frankfurt origin of the incoming feed says nothing about the location of the next leader or the desk's submit route.
Price the state that could exist
The response should be evaluated against at least three states. The first is the last confirmed state. The second applies every decoded transaction from the observed fork in order. The third adds a conservative contention model for transactions that may land before the response. A route profitable only in the second state has no safety margin.
Suppose a decoded swap moves pool A from 100.00 to 100.43 while pool B remains at 100.17. The headline spread is about 26 basis points. Subtract pool fees on both legs, priority fee, expected adverse movement, failure cost, and inventory hedge cost. If they total 20 basis points, 6 remain. An 11-basis-point stale-state haircut rejects the trade.
Pretending the observed swap is final cannot improve the decision. Skipped slots, failed transactions, replacement forks, and missing preceding entries can all invalidate state. Give each case a confidence label that follows the event into the order record.
Landing is a separate system
Seeing a dislocation before an RPC client does not establish transaction priority. The response must still reach a leader, carry a recent blockhash, fit account and compute constraints, bid an appropriate priority fee, and avoid expiration. Competing searchers may have a shorter submission path or a better execution position. The leader may already have built the relevant part of its block.
Atomicity also has boundaries. A single Solana transaction can make multiple on-chain legs atomic when account and compute limits permit. A centralized exchange leg cannot share that property. Inventory must cover partial fills and exchange outages. Earlier raw-feed observation never makes a cross-venue route atomic.
The correct success metric is not detected spreads. Measure submitted opportunities, simulated profitability at decision time, landed transactions, executed profit, failed fees, hedge slippage, and profit after all costs. Join each outcome to the source slot, shred arrival timestamps, decode completion, sign time, send time, and landed slot.
UDP loss changes confidence
The arbitrage receiver gets no packet ordering, no retransmission, and no sender backpressure from raw UDP. It tolerates duplicates, restores index order, and turns to coding shreds for recovery. A kernel buffer absorbs only a finite stall, never sustained overload. Size it from a declared pause window, short-interval packet measurements, and an explicit burst allowance.
Track each gap under its slot and recovery-set identity. When the entry carrying a pool mutation misses the strategy deadline, label derived state incomplete. Never carry the last price forward silently.
Source filtering matters. The desk authorizes 203.23.178.228 only on its purchased UDP port while local policy rejects unexpected senders. A destination challenge lasts 600 seconds. Passing it proves momentary reachability, not loss-free production delivery.
Architecture for a narrow hot path
The receive thread should do four things: read batches, timestamp them, perform cheap validation, and enqueue references. FEC workers group by slot and set. Decode workers reconstruct entries. Strategy workers maintain fork-labeled pool state and evaluate prepared routes. A submission process owns keys and outbound connections. Separating these responsibilities makes each queue measurable.
Backpressure exists only inside the receiver because upstream transmission continues at its own rate. Every queue needs a bound and overload rule. Dropping oldest work may be correct when stale arbitrage has no value. Dropping coding shreds first may save decode capacity until loss makes recovery necessary. Surface the chosen rule as a metric.
Clock discipline gives the measurements meaning. Kernel receive timestamps, a monotonic process clock, and synchronized hosts permit stage comparisons. One-way latency from the leader is harder because leader clocks and capture points differ. Compare distributions and controlled paths, not a single attractive minimum.
Build for opportunities measured in milliseconds
Raw shreds deliver their advantage when the opportunity lifetime rewards earlier observation and the desk runs a prepared packet pipeline with a low-latency submit path. Use canonical commitment for accounting, settlement, and customer balances.
Frankfurt sends delivery toward a single configured IP and port. A distant receiver pays network propagation before detection. Raw UDP leaves sequence repair, retransmission, and overload control to the arbitrage receiver, with no regional redundancy or service-level guarantee. Choose placement and recovery policy around those properties.
The edge is the measured remainder
An arbitrage desk converts a shred feed into an edge by measuring its whole route. The meaningful number subtracts every local processing stage, outbound send, and landing uncertainty from opportunity lifetime. Earlier observation creates value when the remainder stays positive after fees and failure costs.
What this desk reads
- slot, to reject stale state and bind every observation to a fork candidate
- shred index, to order payload fragments and estimate progress through the slot
- FEC set index, to group recovery work without waiting for unrelated shreds
- data or coding variant, to prefer data on the fast path and use coding shreds for repair
- completion flags, to know when an entry boundary or slot boundary is available
- leader authentication, to validate proposed pool data before changing the price model
- transaction account keys and instruction data, to identify pools, vaults, direction, and amount
Questions
- Does a shred feed reveal pending Solana swaps?
- No. Solana exposes no Ethereum-style public mempool. Shreds show a swap after its leader begins candidate block production. That observation precedes normal RPC delivery, while any response still seeks a later place in execution and may not land.
- How much local latency should an arbitrage system target?
- Under these assumptions, the desk can aim for roughly 2 to 17 milliseconds from detection until send. Landing adds about 50 to 450 milliseconds of wider variance. Geography, recovery work, signer policy, leader access, account contention, and priority fees can move those ranges, so every stage needs production histograms.
- Can raw shreds guarantee an arbitrage profit?
- No. Raw shreds reduce observation delay. They do not guarantee finality, transaction priority, atomicity across external venues, state freshness, or a successful landing. Profit must be measured after pool fees, priority fees, failed transactions, adverse movement, inventory carry, and any hedge slippage.