<p>Each input signs a different message. It is always the spending transaction with all inputs blanked out except for the input being signed. So when signing the second input, anything in the scriptSig for the first input is ignored. This allows for independent signing and verification - you don't need to have signed the first input in order to sign and verify the second input.</p>

CC BY-SA 4.0
2022-07-02T18:06:45.087Z
Ok, so if I understand what you're saying, The first message in the above example is : https://www.toptal.com/developers/hastebin/wepajikove.yaml in a first time. Once the first input was signed I sign the second input by ignoring the first scriptSig data input (message available here) :
https://www.toptal.com/developers/hastebin/gosasuxuqu.yaml ?
Loopite
CC BY-SA 4.0
2022-07-02T18:29:02.807Z
@Loopite Not quite. In the first message, you have to blank out the second input, and in the second, you blank the first input. So your second is correct, the first is not.
Ava Chow
CC BY-SA 4.0
2022-07-02T14:43:03.493Z
2022-07-02T14:43:03.493Z
Ava Chow
<p>When we sign a transaction at least with 2 inputs and SIGHASH_ALL flag, what happend to the signature message ?</p>
<p>For example:</p>
<pre><code>version: 01000000
inputs:  02
  txid: b7994a0db2f373a29227e1d90da883c6ce1cb0dd2d6812e4558041ebbbcfa54b
  vout: 00000000
  scriptsigsize: 19
  scriptsig: 76a9144299ff317fcd12ef19047df66d72454691797bfc88ac
  sequence: ffffffff
  ----------------------------------------------------------------------
  txid: e9431833fc2380477723e4b50aa6386dc8d6b86a3a6911a240cfacd68208ea28
  vout: 00000001
  scriptsigsize: 19
  scriptsig: 76a9144299ff317fcd12ef19047df66d72454691797bfc88ac
  sequence: ffffffff
outputs: 01
  amount: c965000000000000
  scriptpubkeysize: 19
  scriptpubkey: 76a914b3e2819b6262e0b1f19fc7229d75677f347c91ac88ac
locktime: 00000000
</code></pre>
<p>Step 1: Take the first input sign it and replace scriptSigSize and scriptSig by the signature size and the signature data. Then, do I have to edit the message with the replaced input scriptSig? Or Do I keep the <strong>same</strong> transaction message for every signature in the same transaction ?</p>
<p>Best wishes</p>

<transactions>
Inputs Transaction Signining
Loopite
# Inputs Transaction Signining

(Asked by: username_0 on 2022-07-02)

When we sign a transaction at least with 2 inputs and SIGHASH\_ALL flag, what happend to the signature message ?

For example:

```
version: 01000000
inputs:  02
  txid: b7994a0db2f373a29227e1d90da883c6ce1cb0dd2d6812e4558041ebbbcfa54b
  vout: 00000000
  scriptsigsize: 19
  scriptsig: 76a9144299ff317fcd12ef19047df66d72454691797bfc88ac
  sequence: ffffffff
  ----------------------------------------------------------------------
  txid: e9431833fc2380477723e4b50aa6386dc8d6b86a3a6911a240cfacd68208ea28
  vout: 00000001
  scriptsigsize: 19
  scriptsig: 76a9144299ff317fcd12ef19047df66d72454691797bfc88ac
  sequence: ffffffff
outputs: 01
  amount: c965000000000000
  scriptpubkeysize: 19
  scriptpubkey: 76a914b3e2819b6262e0b1f19fc7229d75677f347c91ac88ac
locktime: 00000000

```

Step 1: Take the first input sign it and replace scriptSigSize and scriptSig by the signature size and the signature data. Then, do I have to edit the message with the replaced input scriptSig? Or Do I keep the **same** transaction message for every signature in the same transaction ?

Best wishes

**Tags:** transactions


---

## 1 answers

### Answer by username_1 on 2022-07-02. Score: 3 | Accepted answer

Each input signs a different message. It is always the spending transaction with all inputs blanked out except for the input being signed. So when signing the second input, anything in the scriptSig for the first input is ignored. This allows for independent signing and verification - you don't need to have signed the first input in order to sign and verify the second input.

> **Comments:**
> **username_0**: Ok, so if I understand what you're saying, The first message in the above example is : https://www.toptal.com/developers/hastebin/wepajikove.yaml in a first time. Once the first input was signed I sign the second input by ignoring the first scriptSig data input (message available here) : https://www.toptal.com/developers/hastebin/gosasuxuqu.yaml ?  
> **username_1**: @username_0 Not quite. In the first message, you have to blank out the second input, and in the second, you blank the first input. So your second is correct, the first is not.  

---

