2

In this video, the lecturer explains that before the whole transaction get signed, the scriptSig part of inputs are removed, and this causes the ability to perform transaction malleability attacks. My question is that, why are scriptSigs are removed? Why are they not as a part of the message to be signed?

1 Answer 1

7

Because they can't be.

The scriptSig values contain the signatures. If they were included in the message being signed, you'd need signatures that sign themselves. That's not possible.

6
  • I can't understand it. The signature in the scriptSig is completely independent of the transaction, is it right? Why is it impossible? May 11, 2023 at 14:48
  • In other words, from what I understand, by signing the input, I just unlocked it, and the unlocked utxo can be spent in any transaction to any address. So after one make up a transaction by putting together signed inputs and desired outputs it should re-sign this whole new structure. Now the signature of each input differs from signature of the whole transaction. Although the signature of transaction is dependent to the input (because transaction contains inputs) but the opposite is not true. Are my assumptions correct? May 11, 2023 at 15:14
  • 4
    The message being signed by every signature includes (effectively) the entire transaction, except the signatures themselves. May 11, 2023 at 16:18
  • Sorry but I have difficulty understanding it. Any input must have a scriptSig that when we put it alongside the pointed output's scriptPubKey it pops non zero on the stack at the end of the execution. So the scriptSig of every input is exclusively for unlocking that specific input, and has nothing to do with other inputs and outputs in the current transaction. So I can't understand how it is possible that a signature of an input signs other parts of the transaction. If you think it's a totally different question, I can ask it on another thread. May 12, 2023 at 18:35
  • @AmirrezaRiahi It's not correct that the signature in a transaction input has nothing to do with the other parts of the transaction. Each signature (so one in every input) signs the entire transaction (including all other inputs and all outputs). Each is a signature with the public key of the output being spent, but they all sign off on the entirety of the transaction. May 12, 2023 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.