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

computeSignerGrantHash

Computes the 32-byte hash that a signer key signs for a signer-key grant. It equals pox-5 get-signer-grant-message-hash for the same signer-manager, authId and chain.


Usage

import { computeSignerGrantHash } from '@stacks/bitcoin-staking';
import { bytesToHex } from '@stacks/common';

const hash = computeSignerGrantHash({
  signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
  authId: 1n,
  chainId: 1,
});

bytesToHex(hash); // '33b15ac6e3b6a588de6e4e6860d88802e17decabf8ef0c3efc03f8d250fb47e5'

Notes


Signature


Returns

Uint8Array

The 32-byte SHA-256 hash.


Parameters

opts.signerManager (required)

  • Type: string

Stacks principal of the signer-manager being authorized.

opts.authId (required)

  • Type: IntegerType

Replay nonce of the grant.

opts.chainId (required)

  • Type: number

Chain ID of the network the grant is for: 1 on mainnet, 0x80000000 on testnet.

Was this helpful?