SignatureHash description

0

SignatureHash takes in as input a scriptCode:

uint256 SignatureHash(
    const CScript& scriptCode, 
    const CTransaction& txTo, 
    unsigned int nIn, 
    int nHashType, 
    const CAmount& amount, 
    SigVersion sigversion, 
    const PrecomputedTransactionData* cache)

What is the scriptCode exactly?

qweruiop

Posted 2018-04-11T02:27:50.867

Reputation: 111

Answers

1

In this particular case, the parameter script code refers to a public key script.

Usually, the function SignatureHash is invoked to either sign a transaction or to verify a signature. Thus it refers to a transaction input (this is either the transaction input for which we want to generate the signature that will then be placed in the signature script or the transaction input from which we have extracted the signature that we want to verify). This transaction input refers to an unspent (at the time of creating the transaction) transaction output, and this transaction output contains a script that should match the script in the input. It is this script that is passed as a parameter.

On my blog, I have a detailed post on the process of signing a bitcoin transaction which you might find helpful.

christianb93

Posted 2018-04-11T02:27:50.867

Reputation: 81