Every raw event.
No node required.
The immutable, replayable log of everything the chain emits — ordered, cursor-paginated, reorg-aware. Tail the tip over SSE, page over REST, or pull signed bulk dumps — the raw feed you'd run a node for.
import { createStreamsClient } from "@secondlayer/sdk";
const streams = createStreamsClient({ apiKey: process.env.SL_API_KEY });
// Every event the chain emits, in order — resume from any
// cursor, reorg-aware, no node to run.
await streams.events.consume({
fromCursor: lastCheckpoint,
types: ["print"],
contractId: "SP2QEZ…BNS-V2",
batchSize: 500,
onBatch: async (events, _envelope, { cursor }) => {
for (const e of events) await handle(e);
await saveCheckpoint(cursor);
},
onReorg: async (reorg, { cursor }) => {
await rollbackFrom(reorg.fork_point_height); // inclusive of the fork block
await saveCheckpoint(cursor);
},
});One firehose, three ways in.
Stream it, pull it, or pay per call.
Tail the tip over SSE, backfill cold history from signed dumps, or let an agent pay per call with x402, no account required.
Read the Streams docs →Live (SSE)
Tail the tip over a single connection — events arrive as they land.
Bulk
Backfill cold history from signed dumps, then tail live with no gap.
x402
No account, no key — an agent pays per call over HTTP 402.
Query
New payload filters on /v1/streams/events: sender, recipient, and asset_identifier (exact-match), alongside the existing contract_id and types. Event types that lack a field simply don't match, so the firehose narrows naturally.
Finality
/v1/streams/tip now returns finalized_height, and every event carries a finalized flag. Finality is anchored to Bitcoin (burn-block) confirmations rather than a fixed count of Stacks blocks, so a finalized event will not reorg.
Caching
Fully-finalized pages (a closed range with to_height ≤ finalized_height) are served Cache-Control: public, max-age=31536000, immutable with a weak ETag and 304 on If-None-Match. Tip-spanning requests stay private, max-age=2, so historical reads are cheap while the live edge stays fresh.
View the changelog →Point your cursor at genesis.
Press play.
Every event the chain emits, ordered and replayable — over SSE, REST, or signed dumps.