> 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/script/registermetadata.md).

# RegisterMetadata

Everything a staker can derive for a paired-BTC `register-for-bond` before the funding Bitcoin transaction exists. Returned by [buildRegisterMetadata](/reference/stacks.js/stacks-bitcoin-staking/script/buildregistermetadata.md).

***

### Usage

```ts
import { buildRegisterMetadata, fetchBond, fetchPoxInfo } from '@stacks/bitcoin-staking';

const bondIndex = 2;
const poxInfo = await fetchPoxInfo({ network: 'mainnet' });
const bond = await fetchBond({ bondIndex, network: 'mainnet' });
if (!bond) throw new Error(`bond ${bondIndex} is not set up`);

const meta = buildRegisterMetadata({
  bondIndex,
  poxInfo,
  bitcoinPublicKey: '02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc',
  stxAddress: 'SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7',
  earlyUnlockBytes: bond.earlyUnlockBytes,
  network: 'mainnet',
});

meta.lockAddress; // fund this address with the sats to lock
meta.unlockHeight; // 994700 for mainnet bond 2
// After the funding transaction confirms:
// buildLockProof({ ...proofInputs, lockScript: meta.lockScript, unlockHeight: meta.unlockHeight })
```

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

***

### Definition

```ts
interface RegisterMetadata {
  lockAddress: string;
  lockScript: Uint8Array;
  outputScript: Uint8Array;
  unlockBytes: Uint8Array;
  unlockHeight: number;
}
```

***

### Properties

| Property       | Type         | Description                                                                                                                                                                                                                                                                                                                                                                     |
| -------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `lockAddress`  | `string`     | P2WSH Bitcoin address to fund with the sats to lock                                                                                                                                                                                                                                                                                                                             |
| `lockScript`   | `Uint8Array` | Witness script the address commits to. Pass as `lockScript` to [buildLockProof](/reference/stacks.js/stacks-bitcoin-staking/proof/buildlockproof.md) or [buildLockProofFromBlock](/reference/stacks.js/stacks-bitcoin-staking/proof/buildlockprooffromblock.md), and to [buildReclaim](/reference/stacks.js/stacks-bitcoin-staking/reclaim/buildreclaim.md) to spend the lockup |
| `outputScript` | `Uint8Array` | 34-byte P2WSH `scriptPubKey` the funding output must carry, the P2WSH form of `lockScript`                                                                                                                                                                                                                                                                                      |
| `unlockBytes`  | `Uint8Array` | Staker subscript, `<pubkey> OP_CHECKSIG`. Pass as `lockup.unlockBytes` to [buildRegisterForBond](/reference/stacks.js/stacks-bitcoin-staking/build/buildregisterforbond.md)                                                                                                                                                                                                     |
| `unlockHeight` | `number`     | Bitcoin block height of the `OP_CHECKLOCKTIMEVERIFY` branch, from [computeBondUnlockHeight](/reference/stacks.js/stacks-bitcoin-staking/script/computebondunlockheight.md)                                                                                                                                                                                                      |


---

# 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/script/registermetadata.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.
