For the complete documentation index, see llms.txt. This page is also available as Markdown.

distributionCycleToBurnHeight

Returns the first Bitcoin block height of a distribution cycle. Pure computation that mirrors the pox-5 read-only distribution-cycle-to-burn-height.


Usage

import { currentDistributionCycle, distributionCycleToBurnHeight, fetchPoxInfo } from '@stacks/bitcoin-staking';

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

const next = currentDistributionCycle(poxInfo) + 1;
const nextStart = distributionCycleToBurnHeight({ distributionCycle: next, poxInfo });
const blocksUntilNext = nextStart - poxInfo.currentBurnchainBlockHeight;

Notes

  • Computes firstBurnchainBlockHeight + distributionCycle * floor(rewardCycleLength / 2). The input is not validated.


Signature

function distributionCycleToBurnHeight(opts: {
  distributionCycle: number;
  poxInfo: PoxInfo;
}): number;

Returns

number

The Bitcoin block height at which the distribution cycle starts.


Parameters

opts.distributionCycle (required)

  • Type: number

The distribution cycle index, as from burnHeightToDistributionIndex.

opts.poxInfo (required)

  • Type: PoxInfo

A PoxInfo, usually from fetchPoxInfo.

Was this helpful?