Guess The (Bitcoin) Private Key

Github page
Release (v0.15)

This program generates Bitcoin Private Key sequentially, or randomly; then check if it is the key for given address(es).
A Bitcoin Private Key is an integer between 1 and ~1077, so to find a Private Key for a given address, we just need to generate a number in that range, and check if it is the key for that address. Sounds easy, right?
But the problem is, 1077 is a big number. A really really big number (to compare, the total number of atoms in observable universe is about 1082). If you are able to check a quintillion keys (1018) per second, you still need 3 170 979 198 376 458 650 431 253 170 979 198 376 458 650 431 253 170 years to check all the possible Bitcoin keys.
But if you are an extremely lucky person, or you have 999999999 GEFORCE RTX 3090 at home, then you could try.
Just in case you are serious about finding a key for a Bitcoin address with positive balance, you may want to try VanitySearch, Kangaroo, or BitCrack
And there was much more efficient way to find a Private Key, but I am afraid that hackers have done long before.

Use GPU for calculation. GPU may work much faster for this kind of task, but this program need to be rewritten in C, C++, Fortran or Python. Java could do the work, but I doubt if it is a good choice.

Install java on your computer, download the GuessPrivateKey.jar file, then enter this command:

$java -jar {this_program} {numbers of threads} {file_contains_bitcoin_addresses} {choice} {start_from}
{numbers of threads}: number of threads, should be equal to your CPU cores (or less, if you want to use it for other tasks). Eg. my CPU has 8 cores, so I set {numbers of threads} to 8.
{choice}: random means guessing keys randomly; up means checking for {start_from} and upper. down means going down from {start_from}.
{start_from}: Starting number. Default value is 0.
Sample commands:
$java -jar GuessPrivateKey.jar 7 bit.txt
# 7 threads, searching randomly for list of address(es) in the file bit.txt
$java -jar GuessPrivateKey.jar 8 bit.txt up 666
# searching sequentially from 666 and upper
$java -jar -Xmx6g GuessPrivateKey.jar 8 bit.txt up 666
# set maximum memory allocation pool to 6GB
If you have a big list of Bitcoin addresses (like, millions), you may need to use the -Xmx option. Eg. for a 1GB input file, I'd like to use 6GB memory (RAM), as the command above.

If found a key, the program will display a message "Found a key!!!", and print info to a file, which has the same name to that WIF key.
Eg. if it found the key "L59eMgqKqxCGXrDWhGwVBZbQBra482LRLzyAj6g5CGKdq6ABCvXz", it will create a file name "L59eMgqKqxCGXrDWhGwVBZbQBra482LRLzyAj6g5CGKdq6ABCvXz.txt" and write these info into it:

1zJBmcSDHZ97Sjm6TmtM5M7ZdPzuiBABm //address
L59eMgqKqxCGXrDWhGwVBZbQBra482LRLzyAj6g5CGKdq6ABCvXz //key in WIF format
EC9B83954E3E5001E34B02A1705779D2B59264BB54784815B3AA3EBC10C622F0 //key in HEX format
So if you find a new .txt file in the same folder with this program, you have found a wallet!
Note: if it cannot create file(s), it will print these info directly into the screen.

The program may give you the following error:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
Do not worry! It is just an harmless error from the library bitcoinj. The program will still run fine.

Compile yourself?
This program uses bitcoinj library, so please remember to include it.

☕ Buy Me a Coffee, please
🪙 Top cryptocurrency prices overview daily — Check this out if you are looking for a crypto coin to buy or sell