BuildGrantSignerKeyTxArgs
The arguments of buildGrantSignerKey: TxParams plus the signer key, the signer-manager it authorizes, the authId, and the signer key's signature over the grant. The builder calls pox-5 grant-signer-key with them.
Usage
import { buildGrantSignerKey, signSignerGrant } from '@stacks/bitcoin-staking';
const signerManager = 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager';
const authId = 1n;
const signerSignature = signSignerGrant({
signerManager,
authId,
chainId: 1, // mainnet
privateKey: signerPrivateKey,
});
const tx = await buildGrantSignerKey({
signerKey: signerPublicKey, // 33-byte compressed, hex or bytes
signerManager,
authId,
signerSignature,
publicKey,
fee: 10_000n,
nonce,
network: 'mainnet',
});Notes
grant-signer-keyrequirescontract-callerto equalsignerManagerand fails withERR_UNAUTHORIZED_SIGNER_REGISTRATION (u26)otherwise. The built transaction calls pox-5 directly, socontract-calleris the transaction's sender. A grant for a signer-manager contract succeeds only when that contract makes the call.signerSignaturemust recover tosignerKeyover the grant hash forsignerManager,authIdand the network's chain ID:ERR_INVALID_SIGNATURE_RECOVER (u13)if no key recovers,ERR_INVALID_SIGNATURE_PUBKEY (u14)if a different key does. verifySignerGrant runs the same check locally.A signer key, signer-manager and
authIdcombination works once. A repeat fails withERR_SIGNER_KEY_GRANT_USED (u12).fetchEligibleGrantSignerKey checks the signature and replay conditions read-only. It does not check the
contract-callercondition.
Definition
Properties
signerKey
Uint8Array | string
Signer's compressed secp256k1 public key, 33 bytes, as bytes or hex. Sent as signer-key (buff 33)
signerManager
string
Contract principal of the signer-manager being authorized. Sent as signer-manager
authId
IntegerType
Replay nonce. Must equal the authId that was signed. Sent as auth-id (uint)
signerSignature
Uint8Array | string
65-byte recoverable signature in RSV order, as bytes or hex, from signSignerGrant. Sent as signer-sig (buff 65)
The transaction fields come from TxParams.
Was this helpful?