Compute the BIP341 taproot script tree Merkle root from control block and leaf hash. Requires control block to have valid length (33 + k*32, with k in {0,1,..,128}).

Synopsis

Declared in <script/interpreter.h>

uint256
ComputeTaprootMerkleRoot(
    std::span<unsigned char const> control,
    uint256 const& tapleaf_hash);

Return Value

The Merkle root of the script tree.

Parameters

Name

Description

control

The Taproot control block containing the Merkle branch.

tapleaf_hash

The hash of the leaf being spent.

Created with MrDocs