SignatureHashSchnorr

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

NameDescription
TThe transaction type being signed.

Parameters

NameDescription
hash_outReceives the computed signature hash.
execdataPer-input execution state used by the sighash.
tx_toThe transaction whose input is being signed.
in_posIndex of the input being signed.
hash_typeThe sighash type byte.
sigversionThe signature version (TAPROOT or TAPSCRIPT).
cachePrecomputed transaction data required for Taproot.
mdbHow to react when required spent-output data is missing.