JeanLucPons / VanitySearch

Bitcoin Address Prefix Finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scan specific private keys - new feature request

mrlogick opened this issue · comments

Hi dear JeanLucPons, I need to scan all the private keys of a file with the GPU. The file may look like this:

f76088f3ca9e54ea599a79a836edc9a902c5d6c3e5a369ac7994e2e7f425fe32
137ba2dc1bb85151ac569a9cc355f1d41698cd2e1e8ab4c98fc387fa1372c8fa
0c8c6fc3df4e76e0226cde7285fd83d81d4964561d496c0bacb107e2b95e962c
[...]
5a79d61ff27b820c71ca86336d041354a7399b01d2efd8284ae90f8372a2590b

Do you think you can you make this?
Or is there already a way to specify the keys?

That's not what the tool does, it bruteforces private keys until it hits a match on a public address. Since you already have private keys, this is not the tool to process them. What you need is to generate the public addresses and check if they have a balance, right? If so, it can be done easily with some python scripting.

Oh, sorry, you have right. I was hacking with a modified project: https://github.com/Telariust/VanitySearch-bitcrack/releases/tag/1.15.4
I need to generate lots of addresses with GPU from my private keys. I tried to understand the code, but I couldn't find where to set my keys instead of the random ones. I know C++ but not the GPU part. Maybe you can tell me where to put my keys and then I can finish by myself.
But, maybe you know some better program with python and CUDA. I need to fill the GPU with lots of keys.

I'm sorry, I'm not a C++ or CUDA programmer. I started learning Python recently (it's pretty easy). I can run code multithreaded on the CPU, but even with that it's VERY slow (despite optimizations) compared to native C++ like VanitySearch. And I'm still having trouble porting Python code to CUDA.

If you already have private keys and you want to find the bitcoin wallet address then read this article. It also has python code that you can use -

https://www.freecodecamp.org/news/how-to-create-a-bitcoin-wallet-address-from-a-private-key-eca3ddd9c05f/

Also check out this Python library, it's truly the fastest I've tested among several other modules/methods https://pypi.org/project/bit/
Here's a snippet you can work with:

from bit import Key, MultiSig
from bit.format import bytes_to_wif
import time

start = time.time()
key = Key.from_hex('f76088f3ca9e54ea599a79a836edc9a902c5d6c3e5a369ac7994e2e7f425fe32')
# or for a random key, use: 
#key = Key()
wif_uncompressed = bytes_to_wif(key.to_bytes(), compressed=False)  # https://ofek.dev/bit/guide/advanced.html#bytes-to-wif
wif_compressed = bytes_to_wif(key.to_bytes(), compressed=True)
key_uncomp = Key(wif_uncompressed)
key_comp = Key(wif_compressed)

print("Private Key (hex)".ljust(40, ' '), key.to_hex())  # ljust fill with spaces
print("Private Key (WIF)".ljust(40, ' '), key_uncomp.to_wif())
print("Private Key (WIF-Compressed)".ljust(40, ' '), key_comp.to_wif())
print("Bitcoin Address (b58check)".ljust(40, ' '), key_uncomp.address)
print("Bitcoin Address Compressed (b58check)".ljust(40, ' '), key.address)
print("Bitcoin Address Compressed (segwit)".ljust(40, ' '), key.segwit_address)

end = time.time()
print('Benchmark time (s)', end - start)

Thanks for the comments guys, but I really need CUDA. I already did it with Rust (which is fast as C++) but CPU-based, so too slow. I think the best way would be to modify VanitySearch to search for predetermined private keys. I think I can do all the C++ to read the keys from the file, check from a list of addresses, etc. The only problem I got it's the GPU part. I don't know how to send a bunch of keys to the gpu and get the addresses returned. Maybe some of you know where I can put my private keys in the VanitySearch code, instead of the random ones.

I don't quite understand - if you already have the private keys, what is it that you are looking for?

I just need a simple thing: I need to compute the addresses from the private keys, in a fast way. The bottle neck is SHA256 and RIPEMD160. With only the CPU i will never finish.

With VanitySearch-bitcrack you can run for example:
$ ./VanitySearch-bitcrack -gpu --keyspace 00001:10000 1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs
and it generate the addresses from these private keys:

0000000000000000000000000000000000000000000000000000000000000001
0000000000000000000000000000000000000000000000000000000000000002
[...]
0000000000000000000000000000000000000000000000000000000000010000

and it checks whether they match this address: 1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs.

But I'd like to specify my pre-determined keys.

So how many private keys do you have?

You can import them into Bitcoin Core and get the public key and the wallet address straight away - as well as any balance in the wallet.

It should be several terabytes of private keys. I don't even have them all stored right now. I had made a quick calculation: it could be a month of GPU computing.

You can try -

https://github.com/iceland2k14/AltCrack

which has an option to input a specific range.

A Bitcoin Private Key is an integer between 1 and ~10^77, 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, 10^77 is a big number. A really really big number (to compare, the total number of atoms in observable universe is about 10^82). If you are able to check a quintillion keys (10^18) 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.

I'm currently working on something similar to this. You can use the GPU accelerated hashing functions over at https://github.com/brichard19/BitCrack/tree/master/cudaMath or https://github.com/JeanLucPons/VanitySearch/blob/master/GPU/GPUHash.h. Unfortunately, your largest bottleneck will be reading the keys from the file unless you use a ramdisk. I currently can do around 10bn SHA256 hashes per second on a 3090(working on improving this number). Not sure what my speeds are for the other hashes currently.

Are you generating random private keys yourself or are you using a file from someone? It's quite a bit faster to do everything on the GPU rather than file -> host read -> copy to device -> hash. Not sure off the top of my head if the -cp arg uses GPU or CPU compute but you can always just read a file and run it through that if you wanted to(it would still be pretty slow).

Thanks guys for the info.
CactusDuper, I'm using a file that could probably have some btc. If you finish your program let me know at my email.

You seriously might be better off with just c++ since your main bottleneck is going to be read speeds. Unless you split your file in chunks you'll need quite a bit of ram for a ramdisk or you can try a good nvme drive. You should really just split it in chunks and do the required hashing on multiple threads at once. Sure GPU is faster at doing the actual maths but you're really gonna be bottlenecked with reading the file unless you just load it all in RAM at once.

did you manage to find a program for converting a private key into a bitcoin address using GPU?

вам удалось найти программу для преобразования приватного ключа в биткойн-адрес с помощью графического процессора?

Welcome https://t.me/Lost_btc