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

SignerKeyGrantOptions

The inputs to the SIP-018 message a signer key signs to authorize a signer-manager. Accepted by buildSignerGrantMessage, computeSignerGrantHash, signSignerGrant and verifySignerGrant. The hash they produce matches pox-5 get-signer-grant-message-hash.


Usage

import { signSignerGrant, verifySignerGrant } from '@stacks/bitcoin-staking';
import { STACKS_MAINNET } from '@stacks/network';

const grant = {
  signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
  authId: 1n,
  chainId: STACKS_MAINNET.chainId, // 1
};

const signature = signSignerGrant({ ...grant, privateKey: signerPrivateKey });
const ok = verifySignerGrant({ ...grant, publicKey: signerPublicKey, signature });

Notes

  • chainId must be the chain ID of the network where grant-signer-key runs. pox-5 builds the domain from its own chain-id (POX_5_SIGNER_DOMAIN), so a signature made for another chain ID does not recover to the signer key and grant-signer-key fails with ERR_INVALID_SIGNATURE_PUBKEY (u14).

  • grant-signer-key records every signer key, signer-manager and authId combination it accepts, and rejects a repeat with ERR_SIGNER_KEY_GRANT_USED (u12). Use a new authId for each grant.

Reference Link


Definition


Properties

Property
Type
Description

signerManager

string

Contract principal of the signer-manager being authorized. Encoded as signer-manager in the message

authId

IntegerType

Replay nonce, encoded as the uint auth-id in the message

chainId

number

Stacks chain ID: 1 for mainnet, 0x80000000 for testnet. Read it from a StacksNetwork object's chainId

Was this helpful?