Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Introduction

stacks.

Build reliable apps & libraries with lightweight, composable, and type-safe modules that interface with Stacks and Bitcoin

bun add @secondlayer/stacks

Composable

Clients, actions, chains. Import what you use; subpath exports for pox5, sbtc, bns, simnet.

Bitcoin-aware

SPV proofs, PoX-5 staking, sBTC deposits with typed post-conditions.

Typed end to end

Clarity ABIs infer argument and return types. No any at the edge.

Overview

// 1. Import modules.
import { createPublicClient, http } from "@secondlayer/stacks";
import { mainnet } from "@secondlayer/stacks/chains";
 
// 2. Set up your client with desired chain & transport.
const client = createPublicClient({
  chain: mainnet,
  transport: http(),
});
 
// 3. Consume an action.
const balance = await client.getBalance({
  address: "SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7",
});

Modules

ModuleDescription
@secondlayer/stacksClients, transports, re-exports
@secondlayer/stacks/accountsprivateKeyToAccount, mnemonicToAccount, wallet providers
@secondlayer/stacks/chainsmainnet, testnet, devnet, defineChain
@secondlayer/stacks/clarityCl.* constructors, serialization, ABI type system
@secondlayer/stacks/actionsreadContract, callContract, transferStx, getContract, multicall
@secondlayer/stacks/transactionsBuild, sign, serialize transactions, multi-sig
@secondlayer/stacks/postconditionsPc fluent builder for post-conditions
@secondlayer/stacks/utilsEncoding, hashing, addresses, unit formatting
@secondlayer/stacks/bitcoinTrust-minimized Bitcoin SPV — proof construction, Clarity codecs, verifier (SIP-044)
@secondlayer/stacks/pox5PoX-5 Bitcoin Staking (SIP-045) — bonds, staking, lockup scripts, signer grants
@secondlayer/stacks/sbtcsbtc() client extension: sBTC deposits, balances, withdrawals
@secondlayer/stacks/filtersEvent and transaction filter builders, re-exported from the root
@secondlayer/stacks/simnetClarinet simnet transport — same getContract client against an in-process VM

Frozen modules

These ship and work but get no further investment — they may be removed in a future major. Prefer Hiro's maintained @stacks/* ecosystem for wallet-side work; Secondlayer is a data-infrastructure company, not a wallet SDK vendor.

Nonce coordination is the exception — it is supported and maintained: it's mempool-aware (built on Secondlayer's data plane) and solves a real multi-broadcast gap, which is why it lives here rather than being deferred to @stacks/*.

ModuleDescription
@secondlayer/stacks/connectWallet connection — browser extensions + setProvider
@secondlayer/stacks/connect/walletconnectWalletConnect v2 — native relay, QR, modal
@secondlayer/stacks/subscriptionsWebSocket watch helpers (watchBlocks, watchMempool, watchTransaction) — not a Webhooks product alias
@secondlayer/stacks/bnsBNS name registration, resolution, zonefiles
@secondlayer/stacks/poxPoX stacking — solo and delegated
@secondlayer/stacks/stackingdaoStackingDAO liquid staking (STX/stSTX)