forked from krruzic/shitcoin-control-center
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminer.py
40 lines (33 loc) · 1.54 KB
/
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
32
33
34
35
36
37
38
39
40
import os
import json
import subprocess
pool_list = []
pool_item = {"pool_address" : "", "wallet_address" : "", "pool_password" : "x", "use_nicehash" : False, "use_tls" : False, "tls_fingerprint" : "", "pool_weight" : 10 }
coin = input("Add coin or start mining? ['add','mine']: ")
data = json.loads("{"+open("config.base").read()+"}")
if coin.upper() == "ADD":
coin = input("Enter the name of the coin: ")
more = "Y"
while (more not in ["N", "n", "no"]):
pool_item["pool_address"] = input("Enter pool URL with port: ").strip()
pool_item["wallet_address"] = input("Enter your address: ").strip()
pool_item["pool_weight"] = int(input("Weight: "))
pool_list.append(pool_item)
more = input("Add another pool? ")
data["pool_list"] = pool_list
with open('config.{}'.format(coin), 'w+', encoding='utf-8') as f:
json.dump(data, f, indent=4, sort_keys=True, ensure_ascii=False)
with open('config.{}'.format(coin), 'r+', encoding='utf-8') as f:
lines = f.readlines()
lines = lines[1:-1]
lines[-1] = lines[-1]+","
f.seek(0)
f.truncate()
f.writelines(lines)
else:
coin = input("Enter the name of the coin: ")
print("\n\n\nNow mining {}!".format(coin))
filepath = dir_path = os.path.dirname(os.path.realpath(__file__))+"\XMR-STAK-RUNNER.bat"
print(filepath + " config.{}".format(coin))
p = subprocess.Popen([filepath, "config.{}".format(coin)], shell=True, stdout = subprocess.PIPE)
stdout, stderr = p.communicate()