When verifying a transaction, the Bitcoin node rebuilds the hash-preimage of it from the transaction that has acquired.
With one-input transaction, it’s straightforward to construct the hash-preimage of it:
- Change the scriptSig to the scriptPubKey the place the funds are being spent from.
- Change the sigHash placement.
The results of the steps above is double hashed, then is verified with the general public key and the “r” and “s” worth of the signature.
However with a two-inputs transaction, which is the whole course of?
To confirm every enter, does the hash-preimage embody the opposite enter?
Thanks upfront, it will be useful if an instance is supplied.
[Context]
I wrote the next code that verifies utilizing ECDSA math a one-input and one-output transaction, each P2PKH: https://github.com/SalvaZaraes/bitcoin-digital-signatures-article/blob/fundamental/verify-p2pkh-tx.py
Now I having issues with constructing the hash-preimage of a two-input transaction, that is the explanation behind asking the higher questions.