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

ExpectedScriptInput

How buildLockProof and buildLockProofFromBlock find the lockup output in the funding transaction: by its P2WSH scriptPubKey (outputScript) or by the witness script it commits to (lockScript). Provide exactly one.


Usage

import { buildLockProof } from '@stacks/bitcoin-staking';
import type { EsploraMerkleProof, RegisterMetadata } from '@stacks/bitcoin-staking';

declare const meta: RegisterMetadata; // from buildRegisterMetadata
declare const txHex: string;
declare const header: string;
declare const merkleProof: EsploraMerkleProof;
declare const txCount: number;

const proofInputs = { txHex, header, merkleProof, txCount, unlockHeight: meta.unlockHeight };

// By witness script
const output = buildLockProof({ ...proofInputs, lockScript: meta.lockScript });

// Or by scriptPubKey, with the same result
const same = buildLockProof({ ...proofInputs, outputScript: meta.outputScript });

Definition


Values

Value
Description

{ outputScript: Uint8Array | string }

The 34-byte P2WSH scriptPubKey, as bytes or hex, for example from buildLockOutputScript or RegisterMetadata outputScript

{ lockScript: Uint8Array | string }

The witness script, as bytes or hex, for example from buildLockScript or RegisterMetadata lockScript. Converted to its P2WSH scriptPubKey before matching

Was this helpful?