0

I'm creating an ethereum wallet and I need to save the wallet data locally at the user's computer. I am, obviously, encrypting the private key. Should I also encrypt the public key?

My main question about this is because what the user shares to get transaction is not the public key but the address, so I imagine that giving away the public key could be somehow a security threat.

Could someone please elaborate on this?

1

No you do not have to encrypt the public key. You can show public keys to any other user on the network.

You can think of the public key and the address as being the same thing in terms of security. The address is just derived from the public key. The only thing that needs to be ABSOLUTELY secured is the private key.

Theoretically, when running an Ethereum node, the default is only to allow localhost to access the node through HTTP RPC so you don't technically need to encrypt the private key, but that introduces a HUGE SECURITY RISK. If the private key is traveling along the "wire" through HTTP attackers could find ways to get in between the connection. Just make sure to always encrypt the private key. Public keys (as in their name) can be shown to the public (any user).

Hope this helps.

  • Just to add to this, if you use the private key to perform a transaction (or otherwise sign something on the blockchain), anyone can compute the public key from that signature. So even if you wanted to keep it a secret for some reason, you can't. – smarx Dec 13 '17 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.