Why is scriptSig filled with scriptPubKey before signing a transaction?

2

1

I'm checking the transaction signing as described here Redeeming a raw transaction step by step example required.

What is the reason for steps 5 and 6: temporarily filling scriptSig with scriptPubKey of the output we want to redeem?

Can't this just be skipped, as with txid and output index we uniquely specify the output thus scriptPubKey and we don't get any value with this filling?

croraf

Posted 2017-11-26T22:21:51.210

Reputation: 1 112

Answers

3

There seem to be no reason: Ken Shirriff's blog explained it this way:

Then the signature is turned into code in the Script language, creating the scriptSig script that is embedded in the transaction. It appears that using the previous transaction's scriptPubKey during signing is for historical reasons rather than any logical reason.[17]

and the link points to a thread from 2013: https://bitcointalk.org/index.php?topic=102487.msg1123257#msg1123257

pebwindkraft

Posted 2017-11-26T22:21:51.210

Reputation: 4 568