Compute the BIP341 Taproot signature hash for one input.

Synopsis

Declared in <script/interpreter.h>

template<typename T>
bool
SignatureHashSchnorr(
    uint256& hash_out,
    ScriptExecutionData& execdata,
    T const& tx_to,
    uint32_t in_pos,
    uint8_t hash_type,
    SigVersion sigversion,
    PrecomputedTransactionData const& cache,
    MissingDataBehavior mdb);

Return Value

true if the hash was computed successfully.

Template Parameters

Name

Description

T

The transaction type being signed.

Parameters

Name

Description

hash_out

Receives the computed signature hash.

execdata

Per‐input execution state used by the sighash.

tx_to

The transaction whose input is being signed.

in_pos

Index of the input being signed.

hash_type

The sighash type byte.

sigversion

The signature version (TAPROOT or TAPSCRIPT).

cache

Precomputed transaction data required for Taproot.

mdb

How to react when required spent‐output data is missing.

Created with MrDocs