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

<blockquote>
  <p>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]</p>
</blockquote>

<p>and the link points to a thread from 2013:
<a href="https://bitcointalk.org/index.php?topic=102487.msg1123257#msg1123257" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=102487.msg1123257#msg1123257</a></p>

CC BY-SA 3.0
2017-11-27T10:13:18.457Z
2017-11-27T10:13:18.457Z
pebwindkraft
<p>I'm checking the transaction signing as described here <a href="https://bitcoin.stackexchange.com/questions/32628/redeeming-a-raw-transaction-step-by-step-example-required">Redeeming a raw transaction step by step example required</a>.</p>

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

<p>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?</p>

<transactions><signature>
Why is scriptSig filled with scriptPubKey before signing a transaction?
croraf
# Why is scriptSig filled with scriptPubKey before signing a transaction?

(Asked by: username_0 on 2017-11-26)

I'm checking the transaction signing as described here [Redeeming a raw transaction step by step example required](https://bitcoin.stackexchange.com/questions/32628/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?

**Tags:** transactions, signature


---

## 1 answers

### Answer by username_1 on 2017-11-27. Score: 4

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>


---

