<p>Answer provided by @Andrew Chow:</p>

<blockquote>
  <p>The benefit is that each signature commits to the inputs and outputs
  of the transaction so that they cannot be changed. If each input only
  commit to one input, then more inputs could be added and malleate the
  transaction. However, there is a sighash type that allows this: sighash
  ANYONECANPAY.</p>
</blockquote>

CC BY-SA 3.0
2017-11-27T22:56:54.913Z
2017-11-27T22:56:54.913Z
croraf
<p>When signing transaction I think the following is done (in short):</p>

<p>For each input</p>

<ul>
<li><strong>all inputs</strong> and outputs are taken</li>
<li>the respective input scriptSig is filled with txPrev.pubScript, other inputs's scriptSigs are left blank?</li>
<li>this is signed and signature is put in scriptSig</li>
</ul>

<p>Is there any benefit for bundling <strong>all inputs</strong> prior to making each signature? Could just respective input be used when signing for that input?</p>

CC BY-SA 3.0
2017-11-27T13:57:55.390Z
this is how segwit transactions work :) read more about quadratic hashing problem and segwit solution. you are on right way
amaclin
<transactions><signature>
Two variants of signing transaction
croraf
# Two variants of signing transaction

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

When signing transaction I think the following is done (in short):

For each input

* **all inputs** and outputs are taken
* the respective input scriptSig is filled with txPrev.pubScript, other inputs's scriptSigs are left blank?
* this is signed and signature is put in scriptSig

Is there any benefit for bundling **all inputs** prior to making each signature? Could just respective input be used when signing for that input?

**Tags:** transactions, signature

> **Comments:**
> **username_1**: this is how segwit transactions work :) read more about quadratic hashing problem and segwit solution. you are on right way  

---

## 1 answers

### Answer by username_0 on 2017-11-27. Score: 1

Answer provided by @Andrew Chow:

> The benefit is that each signature commits to the inputs and outputs
> of the transaction so that they cannot be changed. If each input only
> commit to one input, then more inputs could be added and malleate the
> transaction. However, there is a sighash type that allows this: sighash
> ANYONECANPAY.


---

