Why is obfuscating the Public Key important? I mean nobody can detect who is the owner of a specific Public Key. Therefore, users can generate different Public Keys, and nobody recognizes this. Why do they need to obfuscate the Public Key again with hash?
All the above steps are correct although. The only catch over here is that except for the Scripts, everything else is captured in the Little Endian format (for whatever reasons). So except for Step 5 and Step 9 all other data is stored in the Little Endian format. Took me a while to get to this answer! Just a small tip to keep in mind when implementing!
What is signed is a simplified version of the transaction (replacing the scriptSig, since that is what we are creating). There is a lot here so hopefully I covered it all:
* `version` (4 Bytes) - Transaction format version
* `flag` (2 Byte Array) - Optional flag, if present, must be 0001, which indicates there is witness data in this transaction
* `input ...