How are transactions verified by nodes other than the initial receiver?

0

If I understand correctly, when I create a new transaction from my wallet, I have to sign it and encrypt it. My wallet encrypts the message using the public key of the node it is connected to, so it can decrypt the message when it receives it, and signs the message with my private key, so the node knows it was me who sent the message because my public key is then sent along with the message.

What I don't understand is that when this message is transmitted to the other nodes for verification, how can they decrypt it if it was encrypted using the initial node public key. Furthermore, I read that also the miners should verify the validity of the transactions they have received. How can they decrypt the transactions?

daniel sp

Posted 2018-01-31T15:27:33.433

Reputation: 123

There are some basic wrong assumptions in your post, and Andrew has already pointed into the right direction. There is a set of verification steps, which are described here: https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages. Also I highly recommend Andreas’ book “Mastering Bitcoin”, which is online readable in many languages. Keep on the good work, search the forum, and post your new questions!

pebwindkraft 2018-02-01T08:37:42.050

Answers

1

If I understand correctly, when I create a new transaction from my wallet, I have to sign it and encrypt it. My wallet encrypts the message using the public key of the node it is connected to, so it can decrypt the message when it receives it, and signs the message with my private key, so the node knows it was me who sent the message because my public key is then sent along with the message.

You understand incorrectly. Nothing is encrypted in Bitcoin, there is no need to do so, and, as you noticed, it would make it impossible to verify the contents of the transaction.

Transactions are only signed. The signature both ensures the integrity of the transaction and proves that the sender is actually allowed to send the Bitcoin.

Andrew Chow

Posted 2018-01-31T15:27:33.433

Reputation: 40 910

Thank you very much for your reply. Ok, I see I understood wrongly. However I still don't see how do the other nodes would know my public key. Is it that the transaction is a composite of two things, the transaction data itself, signed with the private key of the sender, along with his/her public key so the nodes can verify that the sender is the owner of the public key?daniel sp 2018-01-31T20:27:12.997

The transaction contains the public key itself along with the signature. Both are contained within the transaction, but the signature does not and cannot cover itself (duh).Andrew Chow 2018-02-01T01:42:25.460