Mine Background in VAST.AI

J
Coinmonks
3 min readJan 31, 2024

--

MINING IN BACKGROUND WORK WITH OC UNTIL SYSTEM IS RENTED

Vast.ai is the market leader in low-cost cloud GPU rental in the Global GPU Market.

VAST.AI

The concept is configure our GPUs to a proper OC meanwhile they are in background mining

First, install python3 and pip if you don’t have them installed.

sudo apt install -y python3-pip

After installing vastai cli tool, close and reopen a terminal(or ssh session).

pip install vastai

Register your vastai API key.

vastai set api-key YOUR_API_KEY

Let’s schedule a mining task.
MACHINE_ID can be found at https://cloud.vast.ai/host/machines/.
Remember the Offer ID you got by typing vastai search offers command.

vastai search offers "machine_id=MACHINE_ID verified=any"

Now we run and instance,

./vastai create instance OFFER_ID --price 20 --disk 2 --image nvidia/cuda:12.0.0-devel-ubuntu22.04 --onstart-cmd "mkdir /miner; cd /miner; wget -qO - https://github.com/Lolliedieb/lolMiner-releases/releases/download/1.82a/lolMiner_v1.82a_Lin64.tar.gz | tar -xzv --strip-components=1; ./lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME --dualmode KARLSENDUAL --dualpool KARLSEN_POOL --dualuser WALLET_KLS.MACHINE_NAME --nocolor --silence 2 --no-cl --screen=-1 --apiport 4444" --ssh --direct

How to OC our RIG meanwhile is mining:

Create a bash file in your home folder

nano check_lolminer.sh

The file should be like that changing the WALLET parameter, that will check if lolMiner is mining to your wallet, so in case that happens then change OC, when rig is rented OC will be automaticly removed for renting

#!/bin/sh
if [ ! -f /tmp/mining ]; then
echo "2" > /tmp/mining
fi
if [ $(ps -edaf | grep WALLET_HYPRA | wc -l ) -gt 1 ]; then
if [ $(cat /tmp/mining) -eq 0 ]; then
echo "1" > /tmp/mining
nvidia-smi -lgc CCLK_VALUE
nvidia-smi -lmc MCKL_VALUE
nvidia-smi -pl POWER VALUE
fi
else
if [ $(cat /tmp/mining) -eq 1 ]; then
echo "0" > /tmp/mining
nvidia-smi -rmc
nvidia-smi -rgc
nvidia-smi -pl $(nvidia-smi -q -d power | grep Default |head -1 | awk '{printf ("%.0f",$5)}')
fi
fi

We give it chmod +x:

chmod +x check_lolminer.sh

It only remains to check that each minute, we edit crontab

sudo crontab -e

We should add:

* * * * * /your_folder_/check_lolminer.sh

Then we will be able to mine with lolMiner meanwhile is not rented and put the desidered OC

Some others algos combinatios:

HYPRA + KARLSEN:
lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME - dualmode KARLSENDUAL - dualpool KARLSEN_POOL - dualuser WALLET_KLS.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

HYPRA + PYRIN:
lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME - dualmode PYRINDUAL - dualpool PYRIN_POOL - dualuser WALLET_KLS.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

HYPRA + ALPH:
lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME - dualmode ALEPHDUAL - dualpool ALPH_POOL - dualuser
WALLET_KLS.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

HYPRA + RXD:
lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME - dualmode RXDDUAL - dualpool RXD_POOL - dualuser
RXD.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

HYPRA + IRON:
lolMiner -a ETHASHB3 -p HYPRA_POOL -u WALLET_HYPRA.MACHINE_NAME - dualmode RXDDUAL - dualpool FISHDUAL - dualuser
RXD.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

NEXA (We can put in nvidia-smi -lmc 5000):
lolMiner -a NEXA -p NEXA_POOL -u WALLET_NEXA.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

ALPH (We can put in nvidia-smi -lmc 810):
lolMiner -a ALEPH -p ALPH_POOL -u WALLET_ALPH.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

RXD (We can put in nvidia-smi -lmc 810):
lolMiner -a RADIANT -p RXD_POOL -u WALLET_RXD.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

PYRIN (We can put in nvidia-smi -lmc 810):
lolMiner -a PYRIN -p RXD_POOL -u WALLET_RXD.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

IRONFISH (We can put in nvidia-smi -lmc 810):
lolMiner -a IRONFISH -p IRON_POOL -u WALLET_IRON.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

FLUX:
lolMiner -a FLUX -p FLUX_POOL -u WALLET_FLUX.MACHINE_NAME - nocolor - silence 2 - no-cl - screen=-1 - apiport 4444

You will be able to check the log of the miner directly from

All that is thanks to #j296jcnub3 from Discord

--

--