<!-- source: https://www.secondlayer.tools/docs/sbtc -->

# sBTC

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

```ts
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:

```json
{
  "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](/data/sbtc).

## Reads

| Read | Route | SDK |
| --- | --- | --- |
| Raw peg log, six topics | `/v1/index/sbtc/events` | `sbtc.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/summary` | none |

## Settlement

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_confirmed` | Means |
| --- | --- |
| `true` | Past the confirmation threshold |
| `false` | Shallow |
| `null` | No 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.

## Tradeoff

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](https://www.secondlayer.tools/docs/webhooks.md#triggers).

## Read next

- [Webhooks](https://www.secondlayer.tools/docs/webhooks.md)

## Notes for agents

- Withdrawal: GET /v1/index/sbtc/withdrawals/:request_id has a settlement object. settlement_confirmed null means no sweep observed yet, not a denial.
- sBTC has no MCP tool; use REST or the SDK. Never call consume() on withdrawals.

## Setup

Ensure setup once, skipping any step already done:
- CLI: `bun add -g @secondlayer/cli`
- Instance: `secondlayer init` writes `INSTANCE_TOKEN`. Loopback `/v1` reads need no key.
- Hosted reads: export `SECONDLAYER_API_KEY` (`sk-sl_*`) or buy credits with `secondlayer credits buy` (`balance`, `refill`), then `secondlayer whoami`
