-
Notifications
You must be signed in to change notification settings - Fork 14
/
miner.py
31 lines (29 loc) · 1008 Bytes
/
miner.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
import send_command
import config
import random
import string
import json
from hashlib import sha512
import multiprocessing
import os
import threading
def mine():
while True:
starter = ''.join([random.choice(string.uppercase+string.lowercase+string.digits) for x in range(5)])
diff = send_command.send({"cmd":"get_difficulty"}, out=True)
diff = json.loads(diff)['difficulty']
on = 0
print str(diff), starter
while True:
check = starter + str(on)
if sha512(check).hexdigest().startswith("1"*diff):
send_command.send({"cmd":"check_coin", "address":config.wallet.find("data", "all")[0]['address'], "starter":starter+str(on), "hash":sha512(check).hexdigest()})
print "Found Coin!"
break
else:
on += 1
for x in range(15):
if os.name != "nt":
multiprocessing.Process(target=mine).start()
else:
threading.Thread(target=mine).start()