I understand how asymmetric cryptosystems and digital signatures work:
You generate a (private key, public key) pair. You never share the private key, you make the public key ... well, public.
You have a set of functions:
- encrypt(public key, plain text) = cipher text
- decrypt(private key, cipher text) = plain text
- sign(private key, plain text) = signed text
- verify_signature(public key, signed text) = is_signature_valid_bool
However, in Bitcoin, the addresses are hashed versions of the public key. There is no way to "undo" the hashing. Hence I'm uncertain how transactions are verified.
I guess the question then is what is actually transferred to whom / stored, when I want to make a transaction. I assumed:
- Input Bitcoin addresses
- Output Bitcoin addresses
- Signature of the transaction with all input address private keys (I guess in order of the inputs)
... but then I don't see how the validation is done. So I assume you sent your public key(s) when you create a transaction. This would explain why you shouldn't use any address again after you spent money from it. The point that confuses me is that I don't see any public keys here
The next unclear thing is the order. Is there an implicit order in which the signatures have to be applied? I assumed this would be done with Script, but I don't see this in the block explorer.
Can somebody shed some light on it?
Non-Answers
- How Blockchain transaction verification takes place?: The accepted answer just says "when a node hears about a new transaction, it checks to make sure that the signature is valid". My question is about how this is done without the public key.