I have an unsigned raw transaction:
I have read these threads:
How to redeem a basic Tx?
Redeeming a raw transaction step by step example required
These threads explain signing a raw transaction with 1 input.
Do I understand correctly that both inputs are to be signed separately?
So first, we sign the first one, then the second one. To sign an input we replace scriptSig for this input with the scriptPubKey, that locks this input. ScriptSig for the other one remains blank.
It this correct?
But in both threads in step 13 something is appended at the end of transaction. It is called hash code type
What is this? Is this has anything to do with sighash type byte the one that is appended to the signature? If not how to determine this value?
What is the correct sighash type for the scenario I described above (signing inputs separately)? Is this: 0x81 (SIGHASH_ALL | SIGHASH_ANYONECANPAY)? Or should this be 0x01 (SIGHASH_ALL)?
I don't know which one is correct as transaction to be signed contains the other input (without scriptSig set but still, it contains it).