Running a search for the 2^36 key and it's been about 6 minutes with no key found. That is with 2^23 keys generated with subtraction of 2^4.
This search takes way too long. Should be found within 10 seconds.
Maybe I'm missing something.
There was a bug in the create_database script,
now it is fixed (copy again that script)
When I run a 2^36 key test with my modified OP script, the results:
This is the public key: 02b3e772216695845fa9dda419fb5daca28154d8aa59ea302f05e916635e47b9f6
Building the Binary Database
Targeting PubKey: 02b3e772216695845fa9dda419fb5daca28154d8aa59ea302f05e916635e47b9f6
[b] Number of PubKeys: 9,000,000
Writing to file every: 900,000 keys
Subtract Value: 9[/b]
Scanning Randomly
Current Random Key: 0x9dafa302d Jumps Made: 983
PK Found: 42387769980
PK Found: 0x9de820a7c
Total Time: 0:00:19.863232
Under 20 seconds to create DB and find the key.Maybe I am missing something in your script arulbero.
And maybe I don't understand your script
9,000,000 keys with subtract value = 9 means that (in my language) you are covering a 9M * 9 = 81M = 2**27 range,
then you want to find a key (42387769980, that is in 2**36 range) in a database that cover a 2**27 range, is it correct?
Why you made:
Jumps Made: 983?
In which range you generate your random private keys?
In my 2 scripts:
space_covered in the DB = number of key stored in db * subtract value and
search_space =
[priv_key - size_of_space_covered_by_DB, priv_key + size_of_space_covered_by_DB] I generate:
1) in DB: only keys equally spaced
2) in the search script: consecutive keys (and for each of these keys, 128 subtractions); in your example, 16 * 128 subtractions
In search script only 1 key is random generated, then I generate consecutive keys_search with number of consecutive keys_search = sustract value, in this way the random key has 50% to produce a sequence of 64 bits that falls in the DB. For each of these keys I perform 2*64 subtractions.
You have to set the parameters in this way:
###DATABASE#####
prefix = '23_4'
data_base_name = 'data-base'+prefix+'.bin'
num_public_keys = 2**23 # 8 millions of keys
num_bytes_db = num_public_keys//8 # 1 bit for each key
sustract= 2**4 #amount to subtract each time, If you modify this, use the same amount to scan.
space_covered = num_public_keys*sustract #2**27 = 128 millions, space covered
Low_m= 2**3 # writing to file every: 2**23/2**3 = 2**20 keys = 1M
target_public_key = "02b3e772216695845fa9dda419fb5daca28154d8aa59ea302f05e916635e47b9f6"
target = ice.pub2upub(target_public_key)
> time python3 create_database.py
Making Binary Data-Base
Keys generated: 8388608
Space covered by the keys spread with distance 16 in the database : 134217728
real 0m12,831s (but with Low_m = 2**7 it takes about 12s)
user 0m12,030s
sys 0m0,800s
> du -sh data-base23_4.bin
1,0M data-base23_4.bin
########################SEARCH PARAMATERS##########################
num = 64# collision margin in bits (multiple of 64 bits)
pk_orig = 42387769980
space_search_start = pk_orig - space_covered #in this way you know for sure that the space search contains the space covered
space_search_end = pk_orig + space_covered
> time python3 search_pk.py
Keys generated in DB: 8388608
Space covered by the keys in DB (the keys are distributed in this space with distance 16) : 134217728
This is the public key: b3e772216695845fa9dda419fb5daca28154d8aa59ea302f05e916635e47b9f6
I need to find this private key: 42387769980
Scanning Binary Sequence
Looking in the range: 42253552252 42521987708
Found!
The private key 42387769980 was recovered successfully!
real 0m0,145s
user 0m0,136s
sys 0m0,009s
Then
it takes about 13s to create the database and to retrieve the key.
With:
prefix = '28_4'
num_public_keys = 2**28 #256 millions of keys
num_bytes_db = num_public_keys//8 #1 bit for each key
sustract= 2**4 #amount to subtract each time, If you modify this, use the same amount to scan.
space_covered = num_public_keys*sustract #2**32 = 4 billions, space covered
Low_m = 2**8
num = 256 #collision margin in bits (multiple of 64 bits)
pk_orig = 42387769980
space_search_start = pk_orig - space_covered #in this way you know for sure that the space search contains the space covered
space_search_end = pk_orig + space_covered
it takes (on average) less than 1 second only to retrieve the key.