from bitcoin import *
import timeit
import random
def main():
privkey = random.randrange(2**256)
search_for = '12oo'
address = ''
count = 0
start = timeit.default_timer()
pubkey_point = ''
print "Searching for %s" % search_for
while not address.startswith(search_for):
privkey += 1
pubkey_point = fast_multiply(G, privkey)
address = pubkey_to_address(pubkey_point)
count += 1
if not count % 1000:
print "Searched %d in %d seconds" % (count, timeit.default_timer()-start)
print "Found address %s" % address
print "Private key HEX %s" % encode_privkey(privkey,'hex')
while True:
if __name__ == '__main__':
main()
Moved this topic to "Programming" since this is a Python question.
See also:
Python is a terrible language for multithreaded number crunching because of the global interpreter lock.
Using multiple processes would be better, but not nearly as efficient.
I would recommend GoLang for something like this, or maybe C++17 or later (something that includes the Boost thread library).
Sorry, not much of an answer: telling you that the route you’re taking is inefficient for the vehicle you have isn’t helpful in choosing the fastest route.
Someone offered me a high paying gig to write crypto-related stuff in D recently, but I am not interested in crypto so I did not bite.
FYI
Hi @bigvito19,
of course it would be possible to split the while
loop into single parallel processes, which then search the intervals [privkey, privkey+N]
. But as Azhrei pointed out, python is not the best choice here. You should use a compiled language like Go, which also has built-in concurrency methods.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.