1
https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29
The last step of pay to pubkey hash transaction is to check the signature of the previous transaction tx hash and pubkey .
But how the script interpreter knows the sig is the signature of the previous transition hash, what if the sig is the signature of some other content?
The code in SignatureHash() looks reconstruct (l1217~1235) part of the transaction and hash again. Then use pubKey to verify the hash and sig. Is the "data" you mentioned above is that the reconstructed byte list? – Carpemer – 2018-08-31T15:22:13.297
It's actually not simple, but there is a good explanation of what is hashed and signed here: https://bitcoin.stackexchange.com/a/5241/60443
– JBaczuk – 2018-08-31T17:15:37.960One more question, in step 9, why the sender will decide the fee (0.001) in the process of generation input. If it is true, how the verifier could know what is the fee from the hash code? Actually, from the code in GitHub, it looks like it uses the original amount directly, and in the gitbub, it output the amount and then sequence (FFFFFFFF), but in that post, the order like amount first, then output script in step 9 and step 10. – Carpemer – 2018-09-01T02:26:49.307