EsploraMerkleProof
The merkle-proof response from an Esplora-compatible indexer (GET /tx/:txid/merkle-proof, as served by Blockstream and mempool.space). buildLockProof takes it as merkleProof.
Usage
import type { EsploraMerkleProof } from '@stacks/bitcoin-staking';
declare const esplora: string; // base URL of an Esplora-compatible API
declare const txid: string; // funding transaction ID
const merkleProof: EsploraMerkleProof = await (
await fetch(`${esplora}/tx/${txid}/merkle-proof`)
).json();Definition
interface EsploraMerkleProof {
/** BTC block height containing the tx. */
block_height: number;
/** Sibling hashes (display/big-endian hex) along the path leaf -> root, bottom-up. */
merkle: string[];
/** 0-indexed position of the tx within the block. */
pos: number;
}Properties
Property
Type
Description
block_height
number
Bitcoin block height containing the transaction. Becomes height in the lockup output
merkle
string[]
Sibling hashes from leaf to root, bottom-up, as display-order (big-endian) hex. buildLockProof reverses each to the internal little-endian order pox-5 folds over
pos
number
Zero-based position of the transaction in the block. Becomes txIndex in the lockup output
Was this helpful?