> 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/cycles/bondphasename.md).

# BondPhaseName

Label for one phase of a set-up bond's lifecycle. Each [BondPhaseRange](/reference/stacks.js/stacks-bitcoin-staking/cycles/bondphaserange.md) from [bondPhaseRanges](/reference/stacks.js/stacks-bitcoin-staking/cycles/bondphaseranges.md) carries one, and [bondStatus](/reference/stacks.js/stacks-bitcoin-staking/cycles/bondstatus.md) returns one for a bond that has been set up.

***

### Usage

```ts
import { type BondPhaseName, bondPhaseRanges, fetchPoxInfo } from '@stacks/bitcoin-staking';

const labels: Record<BondPhaseName, string> = {
  open: 'Open',
  locked: 'Locked',
  unlocked: 'Unlocking',
  finished: 'Finished',
};

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

for (const phase of bondPhaseRanges({ bondIndex: 0, poxInfo })) {
  console.log(labels[phase.name], phase.startBurnHeight, phase.endBurnHeight);
}
```

#### Notes

* The source marks this `@experimental`.
* Boundaries are Bitcoin block heights derived from the bond's start height, its end height (start plus 12 reward cycles), `rewardCycleLength` and `prepareCycleLength`. [bondPhaseRanges](/reference/stacks.js/stacks-bitcoin-staking/cycles/bondphaseranges.md) gives the exact heights.

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

***

### Definition

```ts
type BondPhaseName = 'open' | 'locked' | 'unlocked' | 'finished';
```

***

### Values

| Value        | Description                                                                                                                                                                                                                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'open'`     | From two reward cycles before the start height until `prepareCycleLength` blocks before it. `register-for-bond` can succeed here, except in a prepare phase                                                                         |
| `'locked'`   | From `prepareCycleLength` blocks before the start height until the bond's `get-bond-l1-unlock-height`. Registration fails with `ERR_STAKE_IN_PREPARE_PHASE (u47)` in the final prepare phase, then `ERR_BOND_ALREADY_STARTED (u43)` |
| `'unlocked'` | The last `rewardCycleLength / 2` blocks of the term, through the end height inclusive. Starts at `get-bond-l1-unlock-height`, from which a member can roll into a new position without `ERR_ROLLOVER_TOO_EARLY (u48)`               |
| `'finished'` | After the end height                                                                                                                                                                                                                |


---

# 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/cycles/bondphasename.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.
