nvOC NiceHash Switcher
nvOC makes it easy to squeeze more hashrate out of your GPUs. NiceHash makes it easy to mine altcoins and get paid in Bitcoin. However, nvOC is a customized Ubuntu Linux and the mining software NiceHash provides to mine the most profitable coin only runs on Windows.
This set of scripts bridges the gap. With them, you can use the miners included in nvOC to mine whatever's most profitable at NiceHash. For each supported algorithm, you can customize power, clockspeed, and fan speed settings as you consider appropriate. Power costs are factored into profitability calculations as well, and if no enabled coin is profitable, your rig will be idled until something is profitable.
Setup
-
ssh into your mining rig's m1 account.
-
Clone these files into the same directory as nvOC's oneBash script.
-
Disable oneBash by commenting out all lines in ~/2unix. oneBash should be invoked manually if you add/remove GPUs so it can reconfigure /etc/X11/xorg.conf, but it otherwise isn't used. To keep gnome-terminal from sucking down CPU cycles by constantly restarting the 2unix script, you might want to include something like "sleep 86400" at the end.
-
Edit the block of constants at the top of switch.py. You'll set your power cost and the mining rates and power consumption of various algorithms here. You can extend the performance list to include additional mining algorithms supported by both NiceHash and the miners included with nvOC. Your Bitcoin address and rig name also go here...though if you want to mine to my tipjar, I won't complain. :-)
-
If your network is IPv6-enabled, note that nvOC (as of v17) has a problem connecting to IPv6 hosts. NiceHash makes its API available over both IPv6 and IPv4, so to force it to use IPv4 in the meantime, edit /etc/hosts as follows:
104.20.158.21 api.nicehash.com -
Set switch.py to launch with a cronjob:
0,10,20,30,40,50 * * * * (cd /media/m1/1263-A96E && python2.7 switch.py)
Every 10 minutes (which is how often NiceHash recalculates profitability), the script will run and determine which miner needs to start up. If it's already running, it will leave it alone. If it needs to switch, it kills one miner and starts the other. If nothing's running (because the rig just rebooted or the miner crashed), it will start the miner.
current-profit is a text file that will be updated on every run of switch.py to show which is currently the most profitable. It provides profit values in BTC and your local currency.
The power and hashrate numbers in the stock configuration are for my rig, which currently uses two GeForce GTX 1070s (one reference-design, one a bit factory-overclocked and with a massive cooler) on an Asus Prime Z270-AR, driven by a Thermaltake 650W 80+ Bronze power supply. Wall power is measured with a Kill-a-Watt. Some miners (such as the EWBF miner) show power usage at the card.
Miners are started in Screen sessions (http://www.gnu.org/software/screen) that can be viewed over an ssh login session:
screen -dr miner
When the rig switches algorithms, the Screen session will be closed and a new one opened. Repeat the above to monitor it, or you could use something like this on a monitoring workstation:
while true; do screen -dr miner; done
Adding Algorithms
Some algorithms supported by NiceHash can't be mined with the miners included in nvOC. If you add the appropriate software, though, you can mine these as well. Instructions to add these capabilities will follow.
Sia
To add the miner:
sudo apt install golang-go mkdir /home/m1/gocode GOPATH=/home/m1/gocode go get github.com/robvanmieghem/gominer
To enable mining, uncomment the command beginning with "performance["sia"]" near the top of switch.py. It spans three lines...make sure you uncomment all of them!