sBTC

The peg lifecycle, decoded, plus Bitcoin confirmation of every sweep.

const found = await sl.index.sbtc.withdrawals.get(42);
console.log(found?.withdrawal.status, found?.withdrawal.settlement.settlement_confirmed);

A withdrawal carries a settlement object:

{
"request_id": 42,
"status": "ACCEPTED",
"settlement": { "sweep_txid": "abcd…", "btc_confirmations": 7, "settlement_confirmed": true, "btc_block_height": 880321, "confirmed_at": "2026-06-01T00:00:00.000Z" }
}

Live supply, deposits and withdrawals: sBTC deposits and withdrawals.

ReadRouteSDK
Raw peg log, six topics/v1/index/sbtc/eventssbtc.events.list / walk / consume
Completed deposits/v1/index/sbtc/deposits · /{bitcoin_txid}sbtc.deposits.list / walk / consume
Withdrawal lifecycles/v1/index/sbtc/withdrawals · /{request_id}sbtc.withdrawals.list / walk / get
Totals/v1/index/sbtc/summarynone

A withdrawal-accept only means the signers committed to a sweep, so your instance checks sweep_txid against bitcoind (the bundled full-node profile or an external BITCOIN_RPC). Deposits need no check: completed-deposit fires after the signers see the confirmations.

settlement_confirmedMeans
truePast the confirmation threshold
falseShallow
nullNo sweep observed yet (not a denial)

The list takes it as a filter: ?settlement_confirmed=true is confirmed peg-outs, ?settlement_confirmed=false is the whole not-done bucket.

Withdrawals have no consume: a row mutates as it moves REQUESTED, ACCEPTED, settled, and a checkpoint only moves forward. Mirror the append-only events, derive status from the withdrawal-* topics, and read withdrawals.get(id) for the assembled lifecycle. Settlement is verified against your instance's bitcoind, not a custody guarantee: a signer set still controls the pegged UTXO. A Bitcoin reorg that un-confirms a sweep self-corrects on read. To be pushed: Webhooks.

Edit on GitHub

Quick Start

Copy this prompt into your agent.

Set up Secondlayer Index in this project. It reads Stacks chain data, decoded, from block 1.

1. Install `@secondlayer/sdk` with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Ask me for a Secondlayer API key (`sk-sl_...`, from https://www.secondlayer.tools/signin) and put it in `.env` as `SECONDLAYER_API_KEY`. Never commit it. If I self-host, use `INSTANCE_TOKEN` and my instance URL instead. Until I give you one, read with a free trial key: `curl -X POST https://api.secondlayer.tools/api/public/trial-key` returns `{ key }`, read-only for Streams and Index, good for 24 hours and 100,000 rows. Keep it out of git too.
3. Add a note to `AGENTS.md`, creating it if needed: before using Secondlayer, follow the secondlayer skill if it's installed, and read https://www.secondlayer.tools/llms.txt. Before writing code, read https://www.secondlayer.tools/docs/index.md. Any docs page opens as Markdown when you add `.md` to its URL.
4. If you support skills, run: `bunx skills add ryanwaits/secondlayer --skill secondlayer -y`