Post
Topic
Board Beginners & Help
Merits 2 from 1 user
Re: [Technical] How the address and private key are generated?
by
webtricks
on 25/12/2020, 20:50:43 UTC
⭐ Merited by hugeblack (2)
I'm a very curious person so probably my next personal study will go into "how's made" of these functions applied and mainly on your step 2.

Yeah! It is always nice to learn about encryption and encoding functions and how these functions add the layers of security to any protocol or application. Step 2 is all about Elliptic Curve Cryptography which creates public key from private key.
I have dedicated thread about ECC here: https://bitcointalk.org/index.php?topic=5232734.0
NotATether summarized more info about ECC nicely here: https://bitcointalk.org/index.php?topic=5235482.0
Then of-course, you have Google and YouTube.



Another question, can I just type random 64 characters to get a private key?

The 64-characters are actually the representation of hexadecimal number. So yes, if you randomly type characters between 0-9 and A-F then it's a valid private key, provided that the value of such hexadecimal number is lower than:
Code:
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140

But it is highly inadvisable to create private key manually. It is always better to use pseudo-random number generator algorithms and libraries which most of the bitcoin wallets use.



Can I assume that it'll match someone's private key so I can accidentally benefit of his/her funds??

Yes! There's a probability that you may hit a private key which is already being used. But that probability is so-so low that it doesn't worth an effort. Let me quote a post from o_e_l_e_o stating the magnitude of the difficulty to find a used address:

The reason it will never happen is simply down to math. The numbers we are dealing with here are unimaginably large. For example, if every human on the planet each generated 1 million new addresses every second, and had been doing so since the birth if the universe 13.7 billion years ago, we would only have generated approximately 0.0000000000002% of all possible addresses.



Can I just try sweeping this key? 0000000000000000000000000000000000000000000000000000000000000003
Is this something that an attacker can actually attempt to use, to try sweeping such randomly created keys (eg. as brute force) ?

Yep! You can sweep that key, it's a valid private key as it is within the range of 1 to (approx.) 1.15*10^77. But you mustn't. Attackers can easily brute-force such private keys. In-fact, any manually written private key isn't safe because humans are worst random generator. They are always tend to go for patterns which make the keys predictable.