i did not have crypto education in my colledge, so i do not know how to say correct: do we sign a message/template, or we sign digest of this message calculated by sha256d
i think that ecdsa and sha256d are not related at all. we can create an engine where use any other cryptosecure function e.g. scrypt ( ) with ecdsa. but current bitcoin and other bitcoin forks create digest as sha256d
(even litecoin)
ok, may be ECDSA can sign a message. i do not know. Satoshi signs sha256d ( template )
I would just use like this, for each input use that input's TX hash and output index, and all the outputs, sign that and put the signature in that input's pubScript
Maybe in 16. "We construct the final scriptSig by concatenating: <One-byte script OPCODE containing the length of the DER-encoded signature plus the one-byte hash code type>|< The actual DER-encoded signature plus the one-byte hash code type>|< One-byte script OPCODE containing the length of the public key>|<The actual public key>"
'the one-byte hash code type' this is the hash type
yes. the verifier proceed in opposite way: it takes last byte. depending on it it constructs template (6 variants exist today), hashes it with sha256d and executes verify ( pub, sig ) ecdsa method
I read some data, and I think the reason to use p2pkh is: shorter address (like 20 bytes comparing to 33), and some additional security (in case ECDSA gets broken).