We decode the chain.
You build the index.
Every Stacks event, decoded into typed rows. Read them keyless, or sweep them into your own app index — cursors, reorgs, and backfill on every page.
import { Index } from "@secondlayer/sdk";
import { on } from "@secondlayer/stacks/filters";
import { db } from "./index-db";
const index = new Index();
// One filter, written once — it drives the quick walk here
// and the production consumer in consumer.ts.
const sales = on.contractCall({
contractId: "SPNWZ…E0VQ0S.marketplace-v4",
functionName: "purchase-asset",
});
// Tail every decoded call — no node to run, no Clarity to parse.
for await (const call of index.contractCalls.walk(
sales.toContractCallsParams(),
)) {
const [collection, tokenId] = call.args;
await db
.insertInto("sales")
.values({
tx_id: call.tx_id,
buyer: call.sender,
collection: String(collection),
token_id: String(tokenId),
block_height: call.block_height,
})
.execute();
}One decoded row set.
Three ways in: SDK, CLI, Agent.
Filter, paginate, and cursor-walk the same decoded rows from the typed SDK, your terminal, or an agent.
Read the Index docs →SDK
Typed list and cursor-walking in TypeScript, fully inferred.
const index = new Index();
for await (const t of
index.ftTransfers.walk({ contractId })) {
// t is fully typed
console.log(t.sender, t.amount);
}CLI
Pipeable and scriptable, with JSON whenever you ask for it.
Agent
The whole surface speaks MCP — an agent queries with zero setup.
Staking post-conditions come through on PoX-5 transactions
/v1/index/transactions and /v1/index/mempool now return the SIP-045 staking and pox post-conditions that arrived with epoch 4.0. Before this, a stake call's post-conditions came back as an empty array — the same answer you'd get for a transaction that genuinely carried none.
One day of dogfooding, four fixes
We ran the whole surface from a fresh repo with one API key, the way you would. What broke got fixed the same day:
Field projection reaches the transfer feeds
View the changelog →Build your index.
We run the rest.
No node, no key, no infra to run. Just decoded rows — cursors, reorgs, and backfill — over the same Streams firehose our decoder runs on. See it live in the sBTC Peg Explorer — a full page built on nothing but the keyless API.