I'm reading [Programming Bitcoin][1]. And in Chapter7, the author talked about the way how signature hash is calculated by replacing the transaction's ScriptSig with the corresponding previous ScriptPubKey. I understand that we can't calculate the signature of a transaction with the signature inside it. But why not just drop the ScriptSig part instead of replace it with the previous ScriptPubKey? And by the way, the same confusion arise on me with the p2sh , where the ScriptSig is replaced with the corresponding RedeemScript. [1]: https://github.com/jimmysong/programmingbitcoin