Compute the signature hash for one input under the selected signature version.

Synopsis

Declared in <script/interpreter.h>

template<class T>
uint256
SignatureHash(
    CScript const& scriptCode,
    T const& txTo,
    unsigned int nIn,
    int32_t nHashType,
    CAmount const& amount,
    SigVersion sigversion,
    PrecomputedTransactionData const* cache = nullptr,
    SigHashCache* sighash_cache = nullptr);

Return Value

The 256‐bit signature hash.

Template Parameters

Name

Description

T

The transaction type being signed.

Parameters

Name

Description

scriptCode

The script being executed for this input.

txTo

The transaction whose input is being signed.

nIn

Index of the input being signed.

nHashType

The sighash type byte controlling which parts are committed.

amount

The value of the output being spent.

sigversion

The signature version selecting the hashing scheme.

cache

Optional precomputed transaction data reused across inputs.

sighash_cache

Optional cache of SHA256 midstates for repeated computations.

Created with MrDocs