Trade Rollup
Match in memory, commit sequenced deltas to a hash-chained WAL, roll executions into Merkle-committed batches, and certify each batch with one threshold post-quantum signature
Abstract
The GPU-native deterministic matcher clears 12.76 B orders/sec on a single AMD 8060S (9.13 B on a GB10; parity-verified GPU==CPU). Persisting every order at that rate is physically absurd: 64-byte records at 12.7 B/s is 813 GB/s of writes and 0.81 TB/s of storage growth, and a per-order ML-DSA-65 signature inflates 12.7 B orders to ~43 TB and caps the wire at ~88 K orders/sec.
The correct architecture is therefore NOT "write every order forever." It is:
Run HFT in-memory, commit sequenced deltas, roll up executions, make inclusion/execution provable, and archive cold evidence off the hot path.
Matching is an ephemeral deterministic compute phase. Durability records the ordered input stream, execution deltas, and resulting state roots. Finality signs the batch, not the order — one threshold ML-DSA certificate over the root of a million things, never one per thing.
Motivation — the measured gap each tier must bridge
Every number below is measured, not modeled:
| Layer | Measured rate | Where measured |
|---|---|---|
| GPU deterministic match (in-memory) | 12.76 B ord/s (AMD 8060S) / 9.13 B (GB10) | luxfi/gpu dex/bench, parity-verified |
| Sequential WAL append + fsync | 29 M ord/s (1.87 GB/s) | M1 SSD, 64 B records, 1 MB buffered writes |
| Merkle root build (rollup builder) | 2.35 M events/s/core (≈ 20–25 M/s across cores) | SHA-256 proxy for P3Q cSHAKE256; 2N hashes for N leaves |
| ML-DSA-65 sign | 450 µs — one per batch, amortized ≈ 0 | papers/evmgpu-benchmark |
| Per-order ML-DSA on the wire (anti-pattern) | 88 K ord/s, signature-size-bound | papers/evmgpu-benchmark |
Matching outruns durability by ~3 orders of magnitude. The rollup is the compression stage that reconciles them: batch 10^6 events into one header of a few hundred bytes on-chain, with the raw stream in tiered storage and every event provably included.
For scale context: the consolidated US tape (CTA) is provisioned at ~3.92 M quote msgs/s + 860 K trade msgs/s — roughly 306 MB/s at 64 B/msg. A single tuned NVMe WAL already exceeds the full US consolidated feed; the matcher exceeds it by four orders of magnitude. The exchange is not feed-bound; naive per-event durability is the only thing that could make it disk-bound.
Specification
1. What is rolled up — the full deterministic transition
Not just trades. The rollup commits the complete transition:
input order/cancel/replace stream
↓
sequenced batch
↓
deterministic matching transition
↓
fills + book delta + balances delta
↓
state root
↓
batch certificate (threshold ML-DSA / P3Q / Quasar attestation)
2. BatchHeader — the canonical durable object
BatchHeader {
venue_id
market_id / market_group
batch_seq
start_time_ns
end_time_ns
prev_book_root
input_event_root // accepted orders/cancels/replaces
execution_root // fills, partial fills, rejects
book_delta_root // resulting L2/L3 book mutation
balance_delta_root // custody/accounting settlement mutation
next_book_root
data_availability_root
risk_engine_root // optional: pre-trade risk decisions
fee_root
clearing_root
classical_cert // BLS fast path
pq_cert // threshold ML-DSA / Pulsar / Quasar / P3Q
}
The settlement chain stores the header, the roots, and the finality certificate — hundreds of bytes to a few KB per batch, instead of millions of on-chain transactions, millions of signatures, millions of DB writes.
3. Receipts — inclusion and execution are provable, not asserted
Every participant receives cryptographic receipts, so a counterparty, auditor, or regulator can verify — without trusting the venue — that: an order was accepted; it was sequenced at position i; it matched under deterministic price-time priority; the fill was included; the balance changed correctly; the batch finalized; and the venue cannot rewrite history without invalidating the root/cert.
OrderReceipt {
order_id
account_id_hash
market_id
side
price
qty
client_ts
gateway_recv_ts
sequencer_ts
batch_seq
input_event_index
input_event_hash
input_merkle_proof
batch_header_hash
venue_signature
}
FillReceipt {
order_id
trade_id
batch_seq
execution_index
price
qty
maker_order_hash
taker_order_hash
execution_hash
execution_merkle_proof
balance_delta_proof
batch_header_hash
finality_cert
}
Verification is pure Merkle + certificate checking:
hash(order event) ∈ input_event_root
hash(fill event) ∈ execution_root
balance_delta ∈ balance_delta_root
BatchHeader signed/finalized by the Quasar/P3Q committee
This is drop copy + execution report + clearing record + audit trail, cryptographically committed.
Three evidence levels per order, matching the latency each is available at:
- Immediate execution report (µs, non-final): accepted/rejected, filled/partial, cancelled, sequence number.
- Cryptographic inclusion receipt (sub-ms to ms, at batch close): Merkle
proofs into
input_event_root/execution_root+ batch header hash. - Final settlement receipt (chain finality): finality certificate, balance-delta proof, settlement-chain root.
4. Signature hierarchy — PQ signs the root, never the order
Per order:
gateway auth; low-latency session signature/MAC; optional client signature
NO ML-DSA per order on the hot path
Per batch:
Merkle/STARK commitment over input events
deterministic matching proof or replay proof
book/balance state root
ONE PQ finality cert (threshold ML-DSA — one FIPS-204 signature for the
whole validator committee; compact-cert envelope per the certificate
profile of LP-4900)
Per epoch:
checkpoint root; archival proof; long-term PQ notarization
The threshold ML-DSA construction is Pulsar (LP-4450); the parameter tier is ML-DSA-65 (LP-4420).
P3Q (luxfi/p3q, P3Q-SHA3 profile: cSHAKE256/KMAC256 STARK/FRI, no
curves/pairings — LP-4800,
LP-4810) is the batch
proof/finality envelope, not a per-order primitive — it proves the
deterministic state transition of a batch and anchors the rollup on Z-Chain
(LP-4830); on-chain verification is the
STARK-FRI verifier precompile (LP-4835).
This avoids the ML-DSA storage/wire explosion by construction.
5. Hot path vs cold path
Hot path (brutally small):
client gateway → risk check → sequencer → matcher → execution report → drop copy
The hot path MUST NOT include: fsync per order, L1 transaction per order, PQ signature per order, database transaction per order, JSON, HTTP, EVM execution, or random disk writes.
Cold/finality path (lags by µs–ms):
batch builder → WAL append → root builder → proof builder
→ P3Q/Quasar cert → settlement chain → archive
This split is how serious venues already work: execution is immediate; clearing, drop copy, surveillance, reconciliation, and regulatory reporting are downstream pipelines.
6. Storage tiers
| Tier | Contents | Medium | Retention |
|---|---|---|---|
| 0 — hot memory | active book, risk state, balances, input/execution ring buffers | RAM (unified GPU memory) | seconds–minutes |
| 1 — sequential WAL | accepted/cancel/replace/execution/reject/risk events, gateway ts, sequencer index | append-only segment files; mmap / io_uring / O_DIRECT; batched fsync; CRC + hash chain per segment | hours–days |
| 2 — rollup batches | BatchHeader + roots + state root + PQ cert | settlement chain + DA layer | permanent (canonical) |
| 3 — cold archive | compressed raw WAL/feed segments | S3-compatible object store, erasure-coded; WORM for regulatory retention | per policy |
Indexed by venue_id / market_id / date / batch_seq / segment_id. The chain
stores roots. The archive stores data. The proof links them.
No random writes, no SQL, no per-order fsync on Tier 1 — sequential append is what sustains the measured 1.87 GB/s (29 M ord/s) on a laptop SSD; a modern datacenter NVMe (~7 GB/s) sustains ~110 M ord/s, and striping scales linearly.
7. Concrete throughput design point
Target: 1 M accepted tx/s sustained, 10 M events/s burst, 64–128 B records.
1 M/s × 128 B = 128 MB/s raw — trivial on NVMe with replication
10 M/s × 128 B = 1.28 GB/s raw burst — within a single measured WAL
One rollup per 10^6 events: ~64–128 MB raw WAL, four Merkle roots, one state root, one finality cert → hundreds of bytes to a few KB on-chain. Root build at the measured 2.35 M events/s/core completes a 10^6-event batch in ~0.43 s on one core (~40–50 ms across 10 cores; GPU keccak batches lower it further). That is the compression ratio, and it is why the sustained composite-tx knee sits at the settlement/EVM layer (~1 M tx/s per 2-node fabric), three orders of magnitude under raw matching — by design, not defect.
8. Venue interface — what institutional traders expect
Externally the venue looks like an exchange, not a blockchain:
- Order entry: FIX, binary gateway (OUCH-like), cancel-on-disconnect, self-trade prevention, kill switch, sequence numbers, replay/gap fill, session recovery (LP-9028).
- Market data: ITCH/Pillar-like order-by-order feed; drop copy.
- What we sell: deterministic matching, bounded jitter, fair sequencing, provable inclusion, fast recovery, auditable finality — not raw B/s headlines. Colo targets: gateway ack single-digit–tens of µs; match response µs; publish µs; API/cloud sub-ms.
- Plus the crypto-native part: the rollup certificate alongside the feed and the settlement root on-chain — evidence tradfi venues cannot offer.
9. Architecture
┌──────────────────────────┐
Client / HFT --->│ Binary Gateway / FIX │
└────────────┬─────────────┘
v
┌──────────────────────────┐
│ Pre-trade Risk Engine │
│ limits / fat-finger / STP│
└────────────┬─────────────┘
v
┌──────────────────────────┐
│ Deterministic Sequencer │
│ market_id, seq, ts │
└────────────┬─────────────┘
v
┌──────────────────────────┐
│ GPU / CPU Matcher │
│ price-time priority │
└───────┬──────────┬───────┘
│ v
│ Execution Reports / Drop Copy / Market Data
v
┌──────────────────────┐
│ Sequential WAL │
│ hash-chained segments│
└──────────┬───────────┘
v
┌──────────────────────┐
│ Rollup Builder │
│ roots + state delta │
└──────────┬───────────┘
v
┌──────────────────────┐
│ P3Q / Quasar Cert │
│ one PQ cert per batch│
└──────────┬───────────┘
v
┌──────────────────────┐
│ Lux Settlement │
│ X/P/Z/Q roots │
└──────────────────────┘
HFT-grade speed; exchange-grade replay; regulator-grade audit; blockchain-grade finality; PQ-grade long-term authenticity.
Settlement lands on X-Chain as the asset ledger (LP-1100) under the chain topology and fee model of LP-5210.
Rationale
The apparent conflict between a 12.76 B ord/s matcher and a 29 M ord/s disk is not a problem to be fixed but a design signal: at these match rates, matching is no longer the bottleneck, so a correct exchange treats matching as an ephemeral deterministic compute phase and moves durability, audit, and settlement into batched cryptographic rollups. The venue does not persist computation; it persists commitments to deterministic state transition. Matching runs at memory speed. Durability records the ordered input stream, execution deltas, and resulting state roots. Finality signs the batch, not the order.
Security Considerations
- Venue equivocation: the hash-chained WAL +
prev_book_root/next_book_rootchaining means a venue cannot fork history without producing conflicting signed BatchHeaders — slashable, detectable evidence. - Determinism: the matcher is bit-identical GPU==CPU (parity-verified per
luxfi/gpu dex/bench); any validator can re-execute a batch from
input_event_rootand refuse certification on divergence. - PQ horizon: per-batch threshold ML-DSA + P3Q (hash-based STARK/FRI) keeps long-term evidence quantum-safe without per-order signature cost.
- DA:
data_availability_rootbinds the archived segments; a header without retrievable data is detectable via DA sampling (LP-8501).
References
luxfi/p3q— P3Q-SHA3 STARK/FRI proving profile, Z-Chain substrateluxfi/gpudex/bench— deterministic per-book matcher harnessespapers/evmgpu-benchmark— measured matcher/EVM/FHE accountingpapers/lux-lightspeed-dex
Copyright
Copyright and related rights waived via CC0.