Skip to content
Alchemy Logo

Rebuild a book from diffs

This API is in private preview. Endpoint availability and response schemas may change before general availability.

Subscribe to l2BookDiff. The first message for each market is the current book snapshot with isSnapshot: true; install it as local state. Apply later diffs in height order. The first diff for each market must carry prev_seq equal to that market's snapshot seq; continue checking prev_seq against your local position on every diff.

On a continuity break, discard local state for the affected markets and adopt the pushed message with isSnapshot: true; bootstrap and recovery use the same replacement mechanism.

For a snapshot shared by many consumers, or to let a slow client digest a large book while buffering live updates, use the REST snapshot read instead.

Advance a durable cursor only after downstream storage succeeds. Treat a gap, correction, or finality change as a reason to backfill and reconcile.

Was this page helpful?