> 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/fetch/constructlockupparams.md).

# ConstructLockupParams

The inputs to the L1 lockup script: the staker's address, the CLTV unlock height, and the two unlock subscripts. [fetchConstructLockupScript](/reference/stacks.js/stacks-bitcoin-staking/fetch/fetchconstructlockupscript.md) and [fetchConstructLockupOutputScript](/reference/stacks.js/stacks-bitcoin-staking/fetch/fetchconstructlockupoutputscript.md) accept it, together with a network and client.

***

### Usage

```ts
import {
  type ConstructLockupParams,
  buildUnlockScript,
  fetchBond,
  fetchBondL1UnlockHeight,
  fetchConstructLockupOutputScript,
} from '@stacks/bitcoin-staking';

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

const params: ConstructLockupParams = {
  stxAddress: 'SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7',
  unlockHeight: await fetchBondL1UnlockHeight({ bondIndex: 1, network: 'mainnet' }),
  unlockBytes: buildUnlockScript('0316e35d38b52d4886e40065e4952a49535ce914e02294be58e252d1998f129b19'), // staker's compressed public key
  earlyUnlockBytes: bond.earlyUnlockBytes,
};

const outputScript = await fetchConstructLockupOutputScript({ ...params, network: 'mainnet' });
```

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

***

### Definition

```ts
interface ConstructLockupParams {
  stxAddress: string;
  unlockHeight: IntegerType;
  /** Staker-signature subscript (the `staker-unlock-bytes` contract arg). */
  unlockBytes: Uint8Array | string;
  /** Per-bond early-unlock subscript (from {@link fetchBond}). */
  earlyUnlockBytes: Uint8Array | string;
}
```

***

### Properties

| Property           | Type                   | Description                                                                                                                                                                           |
| ------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stxAddress`       | `string`               | Stacks address of the staker, sent as the `staker` argument. A contract principal is also accepted                                                                                    |
| `unlockHeight`     | `IntegerType`          | Bitcoin block height for the script's `OP_CHECKLOCKTIMEVERIFY` branch, sent as `unlock-burn-height`. Must be below 2^39                                                               |
| `unlockBytes`      | `Uint8Array \| string` | Staker-signature subscript, sent as `staker-unlock-bytes`. Raw bytes or hex, at most 683 bytes                                                                                        |
| `earlyUnlockBytes` | `Uint8Array \| string` | The bond's early-unlock subscript from [fetchBond](/reference/stacks.js/stacks-bitcoin-staking/fetch/fetchbond.md), sent as `early-unlock-bytes`. Raw bytes or hex, at most 683 bytes |


---

# 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/fetch/constructlockupparams.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.
