lhartikk / naivecoin

A tutorial for building a cryptocurrency
https://lhartikk.github.io/
Apache License 2.0
531 stars 266 forks source link

Wallet Uniqueness #19

Open pewsplosions opened 4 years ago

pewsplosions commented 4 years ago

Hi, thank you for the naivecoin and naivechain tutorials!

In the tutorial, when creating the wallet, generating a private key, this is basically how that user will interact with the network right? Their 'credentials' so to speak.

What is there to guarantee that someone else won't generate the same private key one day? I'm still kind of going through it all, but as far as I can tell we're just saving this key to our local hard drive. So is there even a way to check the network to make sure the generated keys are not repeated?

EDIT: If anyone else comes to this with the same question, as far as I can tell most blockchain wallets seem to simply rely on probability to ensure uniqueness in the generated private keys. According to some of the stuff I read the possible keys, for Bitcoin as an example, are so vast that the odds of generating a duplicate key is astronomical and unlikely to happen even with billions of users over multiple lifetimes.

Going to leave this here in case anyone with a better understanding does decide to answer. For some reason I still don't feel comfortable with that answer.

XfedeX commented 2 years ago

There are 2^256 (115792089237316195423570985008687907853269984665640564039457584007913129639936) possible wallets. The chance of creating a duplicate wallet is so small that it's basically zero.

dry1515 commented 10 months ago

There are 2^256 (115792089237316195423570985008687907853269984665640564039457584007913129639936) possible wallets. The chance of creating a duplicate wallet is so small that it's basically zero.

NO