I have an unsigned raw transaction:
01000000020dcc23ccdb3665779a7657577cd33c5c0660e969ea2ffaf5438c58306ebc9dd20100000000ffffffff49508924c21b25ee2ff6aed61ccc202793aa992d3e033f12f2bf4a94d6346d010000000000ffffffff0240420f00000000001976a9140d7ca1e17524d6c96209cf503fb053613cecf8f688aca0f703000000000017a91452636ce984783dac880e139fa3b69b4d9be39ab68700000000
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.
Questions
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).