<p>It's like that because that is how Satoshi wrote the code for it and it has never changed. It can't change without some sort of fork, and thus far, no fork has happened to change it (although segwit will once it activates).</p>

<p>However doing it this way allows for people to more easily do multi-party transactions like CoinJoins. They don't require you to know the <code>scriptPubKey</code> of everyone else's inputs, you just sign what you are able to sign. You don't know the <code>scriptPubKey</code>'s and you don't care, all you need to know is the <code>scriptPubKey</code> for the input that you are signing. This makes it much easier to participate in multi-party transactions especially for those using lite wallets as they don't have the UTXO set.</p>

CC BY-SA 3.0
2017-06-15T20:43:25.457Z
But leaving all the ScriptSig fields empty provide the same usability, you don't need to know everyone else's inputs, while at the same time allow to compute the double-sha256 just once, avoiding the quadratic hash problem. I could understand that this could have been a design decision made by Satoshi, what I can't see is the purpose behind that.
sr_gi
CC BY-SA 3.0
2017-06-15T18:45:45.303Z
2017-06-15T18:45:45.303Z
Ava Chow
<p>As far as I know, the quadratic hashing problem came from the fact that every time a transaction is verified (or signed), the "unsigned transaction" that is hashed and verified changes depending on the transaction input that is being analysed. Basically, the target input <code>ScriptSig</code> is set to the <code>ScriptPubKey</code> of the <code>UTXO</code> to be redeemed, while the other inputs are left empty.</p>

<p>However, what I can't see is what's the reason behind that. Why aren't all the <code>ScriptSig</code> fields assigned either to their <code>UTXO</code> <code>ScriptPubkey</code> field, or left empty? The way it was designed doesn't seems to provide any kind of benefit (at least I can't see it), while it makes you recalculate the <code>double-sha256</code> every single time an input is analysed, leading to a quadratic hashing problem. </p>

CC BY-SA 3.0
2017-11-28T07:55:15.873Z
https://bitcoin.stackexchange.com/questions/63489/why-is-scriptsig-filled-with-scriptpubkey-before-signing-a-transaction Check this.
croraf
<script><hash><signature><quadratic-hashing>
ScriptSig content during signature (quadratic hashing)
sr_gi
# ScriptSig content during signature (quadratic hashing)

(Asked by: username_0 on 2017-06-15)

As far as I know, the quadratic hashing problem came from the fact that every time a transaction is verified (or signed), the "unsigned transaction" that is hashed and verified changes depending on the transaction input that is being analysed. Basically, the target input `ScriptSig` is set to the `ScriptPubKey` of the `UTXO` to be redeemed, while the other inputs are left empty.

However, what I can't see is what's the reason behind that. Why aren't all the `ScriptSig` fields assigned either to their `UTXO` `ScriptPubkey` field, or left empty? The way it was designed doesn't seems to provide any kind of benefit (at least I can't see it), while it makes you recalculate the `double-sha256` every single time an input is analysed, leading to a quadratic hashing problem.

**Tags:** script, hash, signature, quadratic-hashing

> **Comments:**
> **username_1**: https://bitcoin.stackexchange.com/questions/63489/why-is-scriptsig-filled-with-scriptpubkey-before-signing-a-transaction Check this.  

---

## 1 answers

### Answer by username_2 on 2017-06-15. Score: 4 | Accepted answer

It's like that because that is how Satoshi wrote the code for it and it has never changed. It can't change without some sort of fork, and thus far, no fork has happened to change it (although segwit will once it activates).

However doing it this way allows for people to more easily do multi-party transactions like CoinJoins. They don't require you to know the `scriptPubKey` of everyone else's inputs, you just sign what you are able to sign. You don't know the `scriptPubKey`'s and you don't care, all you need to know is the `scriptPubKey` for the input that you are signing. This makes it much easier to participate in multi-party transactions especially for those using lite wallets as they don't have the UTXO set.

> **Comments:**
> **username_0**: But leaving all the ScriptSig fields empty provide the same usability, you don't need to know everyone else's inputs, while at the same time allow to compute the double-sha256 just once, avoiding the quadratic hash problem. I could understand that this could have been a design decision made by Satoshi, what I can't see is the purpose behind that.  

---

