how do I know that no one has the same private key as me? #3488
-
If I use ethers.js to create a new random wallet, how do I know my wallet is unique for me? Is there anyway of guaranteeing this? if not, what are the best practices for generating many unique wallets? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As long as you are using a cryptographic random number generator, you are selecting 256 bits of random data, which is used as your private key. This type of question is a common question, which is fair, because the size of these numbers is so far outside the range of what we deal with day-to-day or can even begin to comprehend. But imagine if you had to pick a random grain of sand on earth and someone else you never met and didn’t know you were picking a grain of sand also had to pick a grain of sand on this earth. The chances you would both pick the same grain is very unlikely. Now, 256-bits is so much bigger than the number of grains of sand. It’s larger than the number of particles in the observable universe. I often find the other direction is more interesting to frame it; imagine you pick a private key, and I want to keep guessing private keys until I find it. There is not enough energy in the entire observable universe for me to run a computer to try guessing it, even if that computer started today and ran until the heat death of the universe. (as an interesting side note: I don’t even need to guess your private key, just a private key that has the same address, which is a 160-bit value; even so this value has the same property of there not being enough accessible energy in the universe) Does that make sense? Ish? :) |
Beta Was this translation helpful? Give feedback.
As long as you are using a cryptographic random number generator, you are selecting 256 bits of random data, which is used as your private key.
This type of question is a common question, which is fair, because the size of these numbers is so far outside the range of what we deal with day-to-day or can even begin to comprehend.
But imagine if you had to pick a random grain of sand on earth and someone else you never met and didn’t know you were picking a grain of sand also had to pick a grain of sand on this earth. The chances you would both pick the same grain is very unlikely.
Now, 256-bits is so much bigger than the number of grains of sand. It’s larger than the number of particles in …