Can I modify the source code of Bitcoin to generate addresses people have already used?

Each time you start bitcoin-qt.exe program will generate new random address

But what happen if I modify source code and compile new version:

After I sync "new" wallet with the chain I can retrieve all BTC on it

• to do the same I can also modify RANDOM generator source code to generate any address which already exist on the network with BTC on it as above

So the question is:

It's possible to modify source code, compile to EXE and generate THAT way existing BTC address with private keys inside wallet.dat (I believe that private keys are created FROM BTC address by bitcoin-qt.exe) to steal the money

• white-hat question? are you trying to find possible attack vectors so that the community can help fix those bugs. Nov 24, 2013 at 22:04
• You have it the wrong way around. Private keys are not created from addresses. In fact, addresses are created from private keys, and in a manner that's designed to make it extremely difficult to reverse the process. Nov 25, 2013 at 0:37

No, because you need the private key to spend the bitcoins. The chance you guess a private key is really, really, really small.

The amount of private keys is 64^16, which is 7.9228163*10^28. Written down this number looks this way:

79,228,163,000,000,000,000,000,000,000

Just to put this number into perspective, the US debt at this moment is:

17,193,871,000,000 \$

If you would be able to guess and check 100 million private keys every day, it would take you (64^16)/100,000,000=7.9228163*10^20 days, which is 2.1706346*10^18 years. That is 2,170,634,600,000,000,000 years.

The approximate age of the earth is estimated at about 4.54*10^9 years, which is 4,540,000,000 years.

• I don't think your numbers are right. 64^16 = 2^96. A private key is a 256-bit integer, so the number of private keys is 2^256, or 1.1*10^77 - way bigger than you said. An address is a 160-bit hash of a public key, so there are 2^160 or 1.4*10^48 possible addresses. The time you estimate to find a key, while it is large, is still about 19 orders of magnitude too small! Jan 27, 2015 at 21:16
• Related i.imgur.com/gUpaqXY.jpg Feb 22, 2019 at 22:24

It's not humans communicating in the bitcoin network, it's the clients they are using. If a client doesn't do what its user tells it to there's nothing you can do about it. In this case, using "compromised" addresses as you suggested is one way of scamming, stealing small amounts of coins from time to time could be a more subtle one.

Therefore to be safe, you need to trust your client not to be manipulated. Some safety precautions could be:

• Use an open source client