Skip to content

Instantly share code, notes, and snippets.

@walkeralencar
Forked from Retord/gen.py
Last active January 5, 2016 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkeralencar/7c1eaa5acc7470d5abf5 to your computer and use it in GitHub Desktop.
Save walkeralencar/7c1eaa5acc7470d5abf5 to your computer and use it in GitHub Desktop.
Decred Address Generator
import subprocess
import os
import time
FNULL = open(os.devnull, 'w')
out = "out.txt" # The address, seed, private key output in out.txt
store = "store.txt" # the text file that will store all the generated address details
genex = "dcraddrgen.exe" # put the direct path link to the exe if its not in the same directory as the python code
req = "DsRick" # put your own name in place of 'Rick' (Make it less than 5 chars. should take lesser time
size = len(req)
got = False
cnt = 0
f2 = open(store, "a")
start_time = time.time()
while (got == False):
subprocess.call([genex , out], stdout=FNULL, stderr=subprocess.STDOUT)
cnt += 1
f1 = open(out, "r")
lines = f1.readlines()
addr = lines[0][15:]
res = addr[:size]
got = (res.lower() == req.lower())
print (cnt, res, got)
arrLine = '[';
for line in lines:
if (len(arrLine) > 1):
arrLine += ', '
arrLine += "'" + line.splitlines()[0].split(': ')[1] + "'"
arrLine += '],\n'
f1.close()
f2.write(arrLine)
if(got == False):
os.remove(out)
f2.close()
print("Total time taken -> %s seconds" % (time.time() - start_time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment