SignatureHash

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

NameDescription
TThe transaction type being signed.

Parameters

NameDescription
scriptCodeThe script being executed for this input.
txToThe transaction whose input is being signed.
nInIndex of the input being signed.
nHashTypeThe sighash type byte controlling which parts are committed.
amountThe value of the output being spent.
sigversionThe signature version selecting the hashing scheme.
cacheOptional precomputed transaction data reused across inputs.
sighash_cacheOptional cache of SHA256 midstates for repeated computations.