-
Notifications
You must be signed in to change notification settings - Fork 1
/
address_finder.py
50 lines (44 loc) · 1.72 KB
/
address_finder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import seed_generator as sg
import time
import multiprocessing as mp
def generate_address(address_string: str, index: int):
mnemonic = sg.bytes_to_mnemonic(sg.generate_bytes())
seed = sg.mnemonic_to_seed(mnemonic)
seed = sg.AugSchemeMPL.key_gen(seed)
for i in range(0, index):
address = sg.get_observer_address(seed, [i])
if address.endswith(address_string):
print(mnemonic)
print(f'Address [{i}]: {address}')
return True
def main(search: str, index: int, threads: int):
try:
start_time = time.time()
found = False
count = 0
tasks = []
# rewrite for multiprocessing
while not found:
# processes = [mp.Process(target=generate_address, args=(address_string, index)) for i in range(0, 6)]
# for p in processes:
# p.start()
# for p in processes:
# p.join()
pool = mp.Pool(processes=threads)
results = [pool.apply_async(generate_address, (search, index)) for i in range(0, threads)]
for r in results:
if r.get():
found = True
break
pool.close()
pool.join()
count += 1
print(count)
print(f"Found in {time.time() - start_time} seconds.")
except KeyboardInterrupt:
exit()
if __name__ == "__main__":
search = input("Enter vanity string to search (recommended 5 characters or less): ")
index = int(input("Enter derivation index to search to (500 is good): "))
threads = int(input("Enter number of threads to use (as many as your cpu can handle): "))
main(search, index, threads)