Bitcoin Forum
March 28, 2024, 03:09:13 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Secret key questions  (Read 1465 times)
KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 04:35:37 PM
 #1

So, I have been thinking this through, and I kind of decided to go crazy all the way now.

We all know that every BTC address has its own unique private key.

And so for extra security, the private key is generated randomly, from a completely random set of 64 HEX chars.

But this is where I'm lost. What exactly is "randomly"? I have searched and found over 4 or 5 essays about types of private key generation. And in many places I cannot understand some few nuances.

Quote from: from Bitcoin Wiki
Specifically, any 256-bit number from 0x1 to 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 is a valid private key.

Why 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140? Why not 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF?


And when you're reading about Private keys you get to the "Elliptic Curve Digital Signature Algorithm"

And again, " A private key is essentially a randomly generated number."

What exactly is randomly generated? Is it as simple as rand() % 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 ? Where it takes any random number from 1 to 1.157920892373162e+77? and then hash them to SHA-256 twice? or is it more complicated than that?

Wouldn't that lead to some wallets being completely easy to crack as their initial code being only a 6 char or 18 char number? It is random after all, don't go tell me about how low the chances are, I know they're almost infinite, but they're still a chance.

Bottom line is, I want a clear idea of how "random" in generation bitcoin private keys is? Thanks for reading.

Beep boop beep boop
The block chain is the main innovation of Bitcoin. It is the first distributed timestamping system.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
BitCoinDream
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
November 03, 2014, 04:58:30 PM
 #2

So, I have been thinking this through, and I kind of decided to go crazy all the way now.

We all know that every BTC address has its own unique private key.

And so for extra security, the private key is generated randomly, from a completely random set of 64 HEX chars.

But this is where I'm lost. What exactly is "randomly"? I have searched and found over 4 or 5 essays about types of private key generation. And in many places I cannot understand some few nuances.

Quote from: from Bitcoin Wiki
Specifically, any 256-bit number from 0x1 to 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 is a valid private key.

Why 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140? Why not 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF?


And when you're reading about Private keys you get to the "Elliptic Curve Digital Signature Algorithm"

And again, " A private key is essentially a randomly generated number."

What exactly is randomly generated? Is it as simple as rand() % 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140 ? Where it takes any random number from 1 to 1.157920892373162e+77? and then hash them to SHA-256 twice? or is it more complicated than that?

Wouldn't that lead to some wallets being completely easy to crack as their initial code being only a 6 char or 18 char number? It is random after all, don't go tell me about how low the chances are, I know they're almost infinite, but they're still a chance.

Bottom line is, I want a clear idea of how "random" in generation bitcoin private keys is? Thanks for reading.


Nice to see that someone is asking out the core questions. All I see now new guys come and ask "How to make quick BTC ?".

To get to the point, I'll request u to read the following 2 threads and then ask if things still remain unclear...

i. https://bitcointalk.org/index.php?topic=563750.0

ii. https://bitcointalk.org/index.php?topic=560557.0

Tammy Chan
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000



View Profile
November 03, 2014, 05:02:03 PM
 #3

I am not an expert, but the following are what I know.

We all know that every BTC address has its own unique private key.

Not true. Private key is 256bit while address is 160bit, so there are many different private keys that are associated with the same address.



Why 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140? Why not 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF?

http://www.reddit.com/r/Bitcoin/comments/22nezb/just_got_my_16_sided_dice_extra_secure_paper/cgp1bto



KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 05:56:28 PM
 #4

Nice to see that someone is asking out the core questions. All I see now new guys come and ask "How to make quick BTC ?".

To get to the point, I'll request u to read the following 2 threads and then ask if things still remain unclear...

i. https://bitcointalk.org/index.php?topic=563750.0

ii. https://bitcointalk.org/index.php?topic=560557.0

So :

1. Private keys are indeed generated through random numbers. Are these numbers simply converted into SHA256 to generate the Private key? Or are they hashed twice? Or is there more to it?

2. Brainwallets. Who the hell came up with such a stupid idea? Reducing bruteforcing techniques to only include dictionary words that can be counted by the finger. Do many people still use Brainwallets?

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

Beep boop beep boop
KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 06:00:13 PM
 #5

I am not an expert, but the following are what I know.

We all know that every BTC address has its own unique private key.

Not true. Private key is 256bit while address is 160bit, so there are many different private keys that are associated with the same address.



Why 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140? Why not 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF?

http://www.reddit.com/r/Bitcoin/comments/22nezb/just_got_my_16_sided_dice_extra_secure_paper/cgp1bto




I see, it's all about the curve's definition. Simple enough. 

Question : How can different private keys have the same address? Maybe the same wallet yes, but when you pick a number, that same number generates both the Private key and the address. If two numbers (or words) collide with the same hash, why would they collide only in the private key generation, and not the Bitcoin address?

Beep boop beep boop
Tammy Chan
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000



View Profile
November 03, 2014, 06:20:19 PM
 #6

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

There are 2^160 addresses in total. That number is incredibly huge.
Let's say everyone in the world (7 billion people) are creating 10000 addresses every second and the addresses created are all unique, it will take 6.620559 * 10^26 years to generate all addresses (=2^160 /7000000000 / 10000 / 60 / 60 / 24 / 365).

For comparison, our universe has an estimated age of 13.798* 10^9 years only (http://en.wikipedia.org/wiki/Age_of_the_universe).

Tammy Chan
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000



View Profile
November 03, 2014, 06:27:00 PM
 #7

I am not an expert, but the following are what I know.

We all know that every BTC address has its own unique private key.

Not true. Private key is 256bit while address is 160bit, so there are many different private keys that are associated with the same address.



Why 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140? Why not 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF?

http://www.reddit.com/r/Bitcoin/comments/22nezb/just_got_my_16_sided_dice_extra_secure_paper/cgp1bto




I see, it's all about the curve's definition. Simple enough. 

Question : How can different private keys have the same address? Maybe the same wallet yes, but when you pick a number, that same number generates both the Private key and the address. If two numbers (or words) collide with the same hash, why would they collide only in the private key generation, and not the Bitcoin address?

How to get the address from the private key: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
Private key is the random number you generated. Address can be computed easily from your private key (but not the reverse).
Even when the inputs (private keys) are different, the outputs (address) could still be the same.
A very bad example would be (-2)^2 = 4 = (2)^2 while -2 ≠ 2.


We know there are slightly less than 2^256 private keys and 2^160 addresses, so theoretically speaking there are an average of 2^96 different private keys that will give the same address.
However, AFAIK, there is no reported case of collision yet (because the chance is extremely low), and so we are not really sure how they are distributed.


KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 06:37:44 PM
 #8

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

There are 2^160 addresses in total. That number is incredibly huge.
Let's say everyone in the world (7 billion people) are creating 10000 addresses every second and the addresses created are all unique, it will take 6.620559 * 10^26 years to generate all addresses (=2^160 /7000000000 / 10000 / 60 / 60 / 24 / 365).

For comparison, our universe has an age of 13.798* 10^9 years only (http://en.wikipedia.org/wiki/Age_of_the_universe).

So any address I search in blockchain.info for example is whether not generated yet, or is generated and empty?

And after looking around a bit, and taking in count all BTC addresses with actual balance, I have rounded up that if someone decided to bruteforce the whole numbers existing that generate private keys, they have a chance of ~~ 1 / (3 x 10^38) of finding a wallet with actual balance.

Beep boop beep boop
Tammy Chan
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000



View Profile
November 03, 2014, 06:46:26 PM
 #9

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

There are 2^160 addresses in total. That number is incredibly huge.
Let's say everyone in the world (7 billion people) are creating 10000 addresses every second and the addresses created are all unique, it will take 6.620559 * 10^26 years to generate all addresses (=2^160 /7000000000 / 10000 / 60 / 60 / 24 / 365).

For comparison, our universe has an age of 13.798* 10^9 years only (http://en.wikipedia.org/wiki/Age_of_the_universe).

So any address I search in blockchain.info for example is whether not generated yet, or is generated and empty?

And after looking around a bit, and taking in count all BTC addresses with actual balance, I have rounded up that if someone decided to bruteforce the whole numbers existing that generate private keys, they have a chance of ~~ 1 / (3 x 10^38) of finding a wallet with actual balance.

You can search any valid address on blockchain.info.
Among the 2^160 valid addresses, only a tiny fraction of them has an associated private key generated. Among them, only a fraction of them has been used.

For example, address 1BitcoinEaterAddressDontSendf59kuE is a valid address but no one has generated a private key for it. Every person can send bitcoin to it, but no one can send bitcoin out of it (unless someone generate the private key with a incredibly tiny chance).

On the other hand, I have the private key for the address in my profile, but I haven't spent any of the bitcoin on it yet.

KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 07:08:07 PM
 #10


How to get the address from the private key: https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
Private key is the random number you generated. Address can be computed easily from your private key (but not the reverse).
Even when the inputs (private keys) are different, the outputs (address) could still be the same.
A very bad example would be (-2)^2 = 4 = (2)^2 while -2 ≠ 2.


We know there are slightly less than 2^256 private keys and 2^160 addresses, so theoretically speaking there are an average of 2^96 different private keys that will give the same address.
However, AFAIK, there is no reported case of collision yet (because the chance is extremely low), and so we are not really sure how they are distributed.




Hmm.. Okay, so :

Every Bitcoin address has 2^96 Private key.

The easiest way to go is to take all the 2^256 Private keys.

The chance of finding X' private key of X known Bitcoin address, is 2^96.

There is roughly about 4 million bitcoin addresses with balance today (rounded up). Let's say 2^22

So the chance of finding any private key that "has balance" is 2^118 / 2^160 ~= 3 / 10^13




Beep boop beep boop
KingZee (OP)
Sr. Member
****
Offline Offline

Activity: 910
Merit: 452


Check your coin privilege


View Profile
November 03, 2014, 07:11:06 PM
 #11

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

There are 2^160 addresses in total. That number is incredibly huge.
Let's say everyone in the world (7 billion people) are creating 10000 addresses every second and the addresses created are all unique, it will take 6.620559 * 10^26 years to generate all addresses (=2^160 /7000000000 / 10000 / 60 / 60 / 24 / 365).

For comparison, our universe has an age of 13.798* 10^9 years only (http://en.wikipedia.org/wiki/Age_of_the_universe).

So any address I search in blockchain.info for example is whether not generated yet, or is generated and empty?

And after looking around a bit, and taking in count all BTC addresses with actual balance, I have rounded up that if someone decided to bruteforce the whole numbers existing that generate private keys, they have a chance of ~~ 1 / (3 x 10^38) of finding a wallet with actual balance.

You can search any valid address on blockchain.info.
Among the 2^160 valid addresses, only a tiny fraction of them has an associated private key generated. Among them, only a fraction of them has been used.

For example, address 1BitcoinEaterAddressDontSendf59kuE is a valid address but no one has generated a private key for it. Every person can send bitcoin to it, but no one can send bitcoin out of it (unless someone generate the private key with a incredibly tiny chance).

On the other hand, I have the private key for the address in my profile, but I haven't spent any of the bitcoin on it yet.

I see! Thanks anyhow for the explanation and for your time! I think I understand now the general idea of how this is. One last thing, you wouldn't know anywhere where I could find a script that automatically finds the BTC address out of a known Private Key?


Beep boop beep boop
Tammy Chan
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000



View Profile
November 03, 2014, 07:42:21 PM
 #12

3. Are all the adresses (who would be generated) from 0 to 0xFFF... already generated? Could I land on wallets that are not existent if I bruteforce numbers?

There are 2^160 addresses in total. That number is incredibly huge.
Let's say everyone in the world (7 billion people) are creating 10000 addresses every second and the addresses created are all unique, it will take 6.620559 * 10^26 years to generate all addresses (=2^160 /7000000000 / 10000 / 60 / 60 / 24 / 365).

For comparison, our universe has an age of 13.798* 10^9 years only (http://en.wikipedia.org/wiki/Age_of_the_universe).

So any address I search in blockchain.info for example is whether not generated yet, or is generated and empty?

And after looking around a bit, and taking in count all BTC addresses with actual balance, I have rounded up that if someone decided to bruteforce the whole numbers existing that generate private keys, they have a chance of ~~ 1 / (3 x 10^38) of finding a wallet with actual balance.

You can search any valid address on blockchain.info.
Among the 2^160 valid addresses, only a tiny fraction of them has an associated private key generated. Among them, only a fraction of them has been used.

For example, address 1BitcoinEaterAddressDontSendf59kuE is a valid address but no one has generated a private key for it. Every person can send bitcoin to it, but no one can send bitcoin out of it (unless someone generate the private key with a incredibly tiny chance).

On the other hand, I have the private key for the address in my profile, but I haven't spent any of the bitcoin on it yet.

I see! Thanks anyhow for the explanation and for your time! I think I understand now the general idea of how this is. One last thing, you wouldn't know anywhere where I could find a script that automatically finds the BTC address out of a known Private Key?

You could go to https://brainwallet.github.io/#generator, click "private key" in the 1st row, enter the private key in the 5th row and you will get the bitcoin address in the 6th row.

Or you could refer to http://davanum.wordpress.com/2014/03/17/generating-a-bitcoin-private-key-and-address/ and slightly modify it to get a simple code to convert the private key to bitcoin address.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!