> For the complete documentation index, see [llms.txt](https://docs.stacks.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stacks.co/reference/stacks.js/stacks-bitcoin-staking/types/bondlockup.md).

# BondLockup

The BTC side of a protocol bond registration: either proofs of L1 BTC lockup outputs, or an amount of sBTC for pox-5 to custody. [buildRegisterForBond](/reference/stacks.js/stacks-bitcoin-staking/build/buildregisterforbond.md) and [fetchEligibleRegisterForBond](/reference/stacks.js/stacks-bitcoin-staking/eligibility/fetcheligibleregisterforbond.md) take it as `lockup`. It maps to the `btc-lockup` argument of pox-5 [`register-for-bond`](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L642-L842): `kind: 'btc'` is sent as `(ok ...)`, `kind: 'sbtc'` as `(err sats)`.

***

### Usage

```ts
import { buildRegisterForBond, fetchPoxInfo } from '@stacks/bitcoin-staking';
import { Pc } from '@stacks/transactions';

const poxInfo = await fetchPoxInfo({ network: 'mainnet' });

// sBTC: pox-5 takes up to 100,000 sats of sBTC from the staker
const tx = await buildRegisterForBond({
  bondIndex: 2,
  signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
  amountUstx,
  lockup: { kind: 'sbtc', sbtcSats: 100_000n },
  publicKey,
  fee: 10_000n,
  nonce,
  network: 'mainnet',
  postConditions: [
    Pc.principal(stakerAddress).willSendEq(amountUstx).ustxToLock(),
    Pc.principal(stakerAddress).willSendLte(100_000n).ft(poxInfo.sbtcContract, 'sbtc-token'),
  ],
});

// L1 BTC: proofs from buildLockProof, unlockBytes from buildRegisterMetadata
const btcLockup = { kind: 'btc', outputs: [output], unlockBytes: meta.unlockBytes } as const;
```

#### Notes

* With `kind: 'sbtc'`, pox-5 transfers only the difference between the sBTC it already custodies for the staker and `sbtcSats`, so `sbtcSats` is an upper bound for the sBTC post condition. Read the token contract from [PoxInfo](/reference/stacks.js/stacks-bitcoin-staking/types/poxinfo.md) `sbtcContract`.
* With `kind: 'btc'`, the staked sats are the sum of the outputs' `amount`. Only the STX lock needs a post condition.
* In both cases the sats count against the staker's allowlist cap for the bond. Above it, `register-for-bond` fails with `ERR_TOO_MUCH_SATS (u10)`.

[**Reference Link**](https://github.com/stx-labs/stacks.js/blob/6101c99efe5a9616ce7e16cef68e28fd10676e7e/packages/bitcoin-staking/src/types.ts#L335-L342)

***

### Definition

```ts
export type BondLockup =
  | { kind: 'btc'; outputs: BondL1LockupOutput[]; unlockBytes: Uint8Array | string }
  | { kind: 'sbtc'; sbtcSats: IntegerType };
```

***

### Values

| Value                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{ kind: 'btc'; outputs; unlockBytes }` | L1 BTC lockup. `outputs` is 1 to 10 [BondL1LockupOutput](/reference/stacks.js/stacks-bitcoin-staking/types/bondl1lockupoutput.md) proofs. `unlockBytes` is the staker's signature subscript, such as the output of [buildUnlockScript](/reference/stacks.js/stacks-bitcoin-staking/script/buildunlockscript.md), sent as `staker-unlock-bytes` (`buff 683`). It must be the subscript the lockup script was built with |
| `{ kind: 'sbtc'; sbtcSats }`            | sBTC lockup. `sbtcSats` is the total sBTC, in sats, to custody for the bond                                                                                                                                                                                                                                                                                                                                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stacks.co/reference/stacks.js/stacks-bitcoin-staking/types/bondlockup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
