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

# fetchSignerCycleMembership

Reads which signer-manager a staker stakes to in one reward cycle, and the micro-STX staked to it. Covers STX-only stakers and protocol bond stakers alike. Wraps the pox-5 read-only `get-signer-cycle-membership`, which reads the `staker-signer-cycle-memberships` map.

***

### Usage

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

async function signerFor(staker: string) {
  const { rewardCycleId: rewardCycle } = await fetchPoxInfo({ network: 'mainnet' });
  const membership = await fetchSignerCycleMembership({ staker, rewardCycle, network: 'mainnet' });
  return membership?.signer; // signer-manager contract principal, or undefined
}
```

#### Notes

* pox-5 writes an entry for every cycle of a position, for STX-only staking and for protocol bonds: `stake`, `stake-update`, `register-for-bond` and `update-bond-registration` all add it ([add-staker-to-signer-for-cycle](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L1739-L1745), called at [L803](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L803-L805), [L907](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L907), [L1056](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L1056) and [L1146](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L1146)).
* For a protocol bond staker, `amountUstx` is the STX locked with the bond ([register-for-bond](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L751-L755)). For an STX-only staker, it is the STX staked.
* The comment above the map in pox-5.clar ([L228](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L228)) reads "Only used for stx-only staking". The comment is out of date: the map holds protocol bond stakers too, and pox-5 reads it to find a bond staker's signer-manager when it reduces bond shares ([L1364-L1367](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L1364-L1367)).
* Pass `signer` as `signerManager` to the staker reward reads such as [fetchEarnedStakerRewards](/reference/stacks.js/stacks-bitcoin-staking/fetch/fetchearnedstakerrewards.md).
* Resolves to `undefined` when the staker has no entry for the cycle ([get-signer-cycle-membership](https://github.com/stacks-network/stacks-core/blob/10474cdec9f9c0bdf05841b58cffc89cdad87a9b/stackslib/src/chainstate/stacks/boot/pox-5.clar#L3134-L3142)).
* A non-2xx response throws an `Error` whose message starts with `Error calling read-only function.` and includes the status code and URL. If the node reports that the call failed, the `Error` message is the node's `cause`.

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

***

### Signature

```ts
function fetchSignerCycleMembership(
  opts: { staker: string; rewardCycle: number } & NetworkClientParam
): Promise<{ amountUstx: bigint; signer: string } | undefined>;
```

`opts` is a [NetworkClientParam](/reference/stacks.js/stacks-network/network/networkclientparam.md) plus `staker` and `rewardCycle`.

***

### Returns

`Promise<{ amountUstx: bigint; signer: string } | undefined>`

Resolves to the membership, or `undefined` when there is none.

| Field        | Type     | Meaning                                                          |
| ------------ | -------- | ---------------------------------------------------------------- |
| `amountUstx` | `bigint` | micro-STX the staker staked to the signer-manager for this cycle |
| `signer`     | `string` | Contract principal of the signer-manager                         |

***

### Parameters

#### opts.staker (required)

* **Type**: `string`

Stacks address of the staker, STX-only or protocol bond.

#### opts.rewardCycle (required)

* **Type**: `number`

Reward cycle to read.

#### opts.network (optional)

* **Type**: `StacksNetworkName | StacksNetwork`

The network to query: a name such as `'mainnet'` or `'testnet'`, or a [StacksNetwork](/reference/stacks.js/stacks-network/network/stacksnetwork.md) object. Defaults to `'mainnet'`.

#### opts.client (optional)

* **Type**: `{ baseUrl?: string; fetch?: FetchFn }`

Overrides the API base URL or the `fetch` function, for example to query your own node. Fields you set replace the network's defaults.


---

# 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/fetchsignercyclemembership.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.
