some updates

This commit is contained in:
2018-01-19 13:48:01 -08:00
parent 222fcf231e
commit f48768742d
6 changed files with 186 additions and 19 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
*~
dbgdata-*

View File

@@ -3,3 +3,52 @@ zpool auto-switcher
TODO: documentation...still early days, but should be similar to my NiceHash
and MiningPoolHub switchers.
zpool's API is largely undocumented. A further complication is that their
profitability estimates aren't reported in the same units for each
algorithm, and while some deviations from the norm are noted on their
homepage, others aren't. I'm mostly going by trial and error, and by
comparison with what MiningPoolHub reports for the algorithms the two pools
have in common.
miners.json
===========
Should ultimately be able to share this with the MiningPoolHub and NiceHash
switchers. Each available algorithm is described with the following values:
bin: command line to launch miner. {HOST}, {PORT}, {USERNAME}, and
{PASSWORD} will be filled in by the switcher.
power_limit: power limit for GPU(s)
gpu_oc: GPU overclock, Hz (or negative for underclock; 0 for stock speed)
mem_oc: memory overclock, Hz (or negative or zero)
fan: fan speed, % (0 for automatic)
speed: total mining speed for this algorithm, GH/s
power: total power consumption, kW
gpu_oc, mem_oc, and fan may be provided as a single value each to be applied
to all cards or as an array each to set cards individually.
algo_map.json
=============
Since different pools may use different labels for the same algorithm, we
need to map what the pool uses to what we used in miners.json. The index is
the pool's label; the value is our label.
conf.json
=========
The values the zpool switcher cares about are these:
card_type: if set to "nvidia", we can set card clocks, fan speeds, etc.
Other values (such as "amd") aren't implemented.
currency: Coinbase only supports "USD" for this value. If you use a
different exchange's data, you may have other options available.
pwrcost: your cost of electric power, in currency units per kWh
min_profit: if the rig's profit falls below this value, stop mining
payment_currency: how you want zpool to pay you
payment_addr: where zpool should send payment
The user_name and miner_name values in the example aren't used by the zpool
switcher, but may be used by other switchers.

34
algo-map.json Normal file
View File

@@ -0,0 +1,34 @@
{
"bitcore": "",
"blake2s": "",
"blakecoin": "",
"c11": "",
"equihash": "Equihash",
"groestl": "Groestl",
"hsr": "",
"keccak": "Keccak",
"lbry": "",
"lyra2v2": "Lyra2RE2",
"m7m": "",
"myr-gr": "Myriad-Groestl",
"neoscrypt": "NeoScrypt",
"nist5": "",
"phi": "",
"polytimos": "",
"quark": "",
"qubit": "Qubit",
"scrypt": "Scrypt",
"sha256": "",
"sib": "",
"skein": "Skein",
"skunk": "",
"timetravel": "",
"tribus": "",
"x11": "X11",
"x11evo": "",
"x13": "",
"x14": "",
"x17": "",
"xevan": "",
"yescrypt": ""
}

10
conf.json Normal file
View File

@@ -0,0 +1,10 @@
{
"user_name": "salfter",
"miner_name": "miner10",
"card_type": "nvidia",
"currency": "USD",
"pwrcost": 0.107,
"min_profit": 0.0,
"payment_currency": "BTC",
"payment_addr": "35KZnxdfnQyzDr6yWDFxXuuFELyiwf2G7V"
}

View File

@@ -1,85 +1,85 @@
{
"Blake-Vanilla":
{
"bin": "/home/m1/SPccminer/ccminer -a vanilla -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a vanilla -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0, "power": 0.389
},
"Cryptonight":
{
"bin": "/home/m1/KTccminer-cryptonight/ccminer -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/KTccminer-cryptonight/ccminer -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.000002, "power": 0.325
},
"Equihash":
{
"bin": "/home/m1/zec/v3_4/miner --eexit 3 --fee 0 --pec --server {HOST} --user {NAME}.{MINER} --pass z --port {PORT}",
"bin": "/home/m1/zec/v3_4/miner --eexit 3 --fee 0 --pec --server {HOST} --user {USERNAME} --pass {PASSWORD} --port {PORT}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.000001140, "power": 0.397
},
"Ethash":
{
"bin": "/home/m1/eth/ethminer_12dev2/ethminer -S {HOST}:{PORT} -O {NAME}.{MINER}:x -U",
"bin": "/home/m1/eth/ethminer_12dev2/ethminer -S {HOST}:{PORT} -O {USERNAME}:{PASSWORD} -U",
"power_limit": [115,115,115,95], "gpu_oc": -200, "mem_oc": 1000, "fan": 0,
"speed": 0.087, "power": 0.397
},
"Groestl":
{
"bin": "/home/m1/SPccminer/ccminer -a groestl -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a groestl -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.0853, "power": 0.392
},
"Keccak":
{
"bin": "/home/m1/SPccminer/ccminer -a keccak -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a keccak -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 1.45, "power": 0.391
},
"Lyra2RE2":
{
"bin": "/home/m1/SPccminer/ccminer -a lyra2v2 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a lyra2v2 -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.081, "power": 0.386
},
"Myriad-Groestl":
{
"bin": "/home/m1/SPccminer/ccminer -a myr-gr -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a myr-gr -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.158, "power": 0.391
},
"Qubit":
{
"bin": "/home/m1/SPccminer/ccminer -a qubit -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a qubit -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.0509, "power": 0.382
},
"Scrypt":
{
"bin": "/home/m1/SPccminer/ccminer -a scrypt -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a scrypt -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.00224, "power": 0.403
},
"Sia":
{
"bin": "/home/m1/SPccminer/ccminer -a sia -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/SPccminer/ccminer -a sia -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0, "power": 0.403
},
"Skein":
{
"bin": "/home/m1/ASccminer/ccminer -a skein -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/ASccminer/ccminer -a skein -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.835, "power": 0.383
},
"NeoScrypt":
{
"bin": "/home/m1/nsgminer/nsgminer -k neoscrypt -g 1 -w 64 -I 15 -o stratum+tcp://{HOST}:{PORT} -O {NAME}.{MINER}:x",
"bin": "/home/m1/nsgminer/nsgminer -k neoscrypt -g 1 -w 64 -I 15 -o stratum+tcp://{HOST}:{PORT} -O {USERNAME}:{PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.0027, "power": 0.397
},
"X11":
{
"bin": "/home/m1/TPccminer/ccminer -a x11 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"bin": "/home/m1/TPccminer/ccminer -a x11 -o stratum+tcp://{HOST}:{PORT} -u {USERNAME} -p {PASSWORD}",
"power_limit": [115,115,115,95], "gpu_oc": [-100,-100,-100,0], "mem_oc": 0, "fan": 0,
"speed": 0.0327, "power": 0.403
}

View File

@@ -17,7 +17,24 @@ import subprocess
import os
import socket
currency="USD"
# load config
DEBUG=False
cfg=json.loads(open(sys.argv[1]).read())
miners=json.loads(open(sys.argv[2]).read())
algo_map=json.loads(open(sys.argv[3]).read())
card_type=cfg["card_type"]
#user_name=cfg["user_name"]
#miner_name=cfg["miner_name"]
currency=cfg["currency"]
pwrcost=cfg["pwrcost"]
min_profit=cfg["min_profit"]
payment_currency=cfg["payment_currency"]
payment_addr=cfg["payment_addr"]
os.environ["DISPLAY"]=":0"
# IPv4 address lookup
@@ -36,7 +53,63 @@ def fetch(prot, host, path, forceipv4=False):
# main
exchrate=float(json.loads(fetch("https", "api.coinbase.com", "/v2/exchange-rates?currency=BTC"))["data"]["rates"][currency])
data=json.loads(fetch("http", "www.zpool.ca", "/api/currencies", True))
if (DEBUG!=True):
exchrate=float(json.loads(fetch("https", "api.coinbase.com", "/v2/exchange-rates?currency=BTC"))["data"]["rates"][currency])
data=json.loads(fetch("http", "www.zpool.ca", "/api/status", True))
else:
exchrate=float(json.loads(open("dbgdata-exchange-rates").read())["data"]["rates"][currency])
data=json.loads(open("dbgdata-status").read())
pprint.pprint(exchrate)
# update algo map
changed=False
for i in data:
try:
k=algo_map[i]
except:
algo_map[i]=""
changed=True
if (changed==True):
with open(sys.argv[3], "w") as outfile:
json.dump(algo_map, outfile, sort_keys=True, indent=2)
# adjust estimates so they're all in the same units: BTC/day per GH/s
for i in data:
data[i]["adjusted_estimate"]=float(data[i]["estimate_current"])*1000
try:
data["sha256"]["adjusted_estimate"]/=1000000000000
except:
pass
try:
data["equihash"]["adjusted_estimate"]*=1000
except:
pass
for i in ["scrypt", "blakecoin", "blake2s", "decred", "x11", "quark", "qubit", "keccak"]:
try:
data[i]["adjusted_estimate"]/=1000
except:
pass
coins={}
for i in data:
if (algo_map[i]!=""):
coins[i]=miners[algo_map[i]]
coins[i]["bin"]=coins[i]["bin"].format(HOST=i+".mine.zpool.ca", PORT=data[i]["port"], USERNAME=payment_addr, PASSWORD="c="+payment_currency)
coins[i]["algo"]=i
coins[i]["mapped_algo"]=algo_map[i]
coins[i]["name"]=i
coins[i]["estimate"]=data[i]["adjusted_estimate"]*float(coins[i]["speed"]) # factor in our speed
for i in data:
print(i+": "+str(data[i]["estimate_current"])+" "+str(data[i]["adjusted_estimate"]))
print("")
for i in coins:
print(i+": "+str(coins[i]["estimate"]))
print("")
for i in coins:
print(i+": "+str(coins[i]["bin"]))