Why do we need to re-parent ScriptSig with the previous ScriptPubKey when calculating the hash of each input signature?


I read Bitcoin programming. And in Chapter 7, the author talked about the way the signature hash is calculated by replacing the ScriptSig of a transaction with the corresponding previous ScriptPubKey. I understand that we cannot calculate the signature of a transaction with the signature inside it. But why not just drop the ScriptSig part instead of replacing it with the previous ScriptPubKey? Incidentally, I get the same confusion with p2sh, where ScriptSig is replaced by the corresponding RedeemScript.



Source link

Related Posts