Cryptocurrency Miner as a Service

Time for a bit of fun!

Following on my previous post about blockchains and cryptocurrencies I thought why not use vRA to automate the deployment of a miner. For those who are not really clued in to the mining side of cryptocurrencies, there are many different mining algorithms used amongst the coins currently doing the rounds.
For example:
• Bitcoin used SHA256.
• Litecoin uses Scrypt .
• Etherium uses Ethash.
• Monero or Electroneum use Cryptonight.

There are many more but some algorithms like SHA256 and Scrypt now require specialized mining hardware known as ASIC’s (a 2w usb ASIC stick is better at mining than a top end graphics cards with these types of algorithms).

Ethash we can thank for the world wide GPU shortage and is predominantly mined with graphic cards as CPU’s do not cut it in comparison.
But there are algorithms like Cryptonight that also use GPU’s but the gap between CPU and GPU is minimal, so anyone with a computer can jump in and have a go. These are designed specifically to be ASIC resistant. Now while GPU is more cost effective as you can have 4 or more graphics cards within a single computer to mine rather than having 4 or more actual full computers doing the mining.

Today I thought why not use vRA and create a Miner as a Service, specifically Cryptonight Miner as a Service. I will be using AWS to do the deploy. I have left this very simple with 3 inputs and I download the source and compile the miner then execute in the background. I do not create a service so if the machine is rebooted it will stop mining. The idea is if it stops – destroy and re deploy.

Now this was really just me playing around but if you do the numbers with some of the cryptonight coins it is possible to make a small margin after paying AWS. While the software component will work on vSphere machine it does require internet access to download the software for github.

Also note the image you use must be configured as a vRA template to utilise software components.
Blueprint can be downloaded Here at VMware Code

1) First we have the software component with 3 inputs.

2) Now I only used one stage being install, I could have broken this up, but was more out of laziness.

Code used is below:

cd /tmp
sudo yum -y install epel-release
sudo yum -y remove cmake
sudo yum -y install centos-release-scl git screen nano
sudo yum -y install cmake3 devtoolset-4-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make
sudo yum -y install gcc
sudo scl enable devtoolset-4 bash
sudo git clone https://github.com/fireice-uk/xmr-stak-cpu.git
cd xmr-stak-cpu

sudo cmake3 -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-4/root/usr/bin/g++ .
#sudo cmake3 .
sudo make

sudo cp bin/xmr-stak-cpu ./xmr-stak-cpu
sudo ./xmr-stak-cpu >> firstrun.txt

sudo chmod +x xmr-stak-cpu
sudo sed -i "s/pool.usxmrpool.com:3333/${pool}/g" config.txt
sudo sed -i "s/wallet_address\" : \"\"/wallet_address\" : \"${wallet}.${worker}\"/g" config.txt
sudo sed -i "s/pool_password\" : \"\"/pool_password\" : \"x\"/g" config.txt

sudo awk '/BEGIN/,/END/' firstrun.txt
sudo sed -i '/cpu_threads_conf/d' ./config.txt
sudo sed -i '0,/null,/ s///' config.txt
sudo sed -i '/Copy&Paste BEGIN /d' ./firstrun.txt
sudo sed -i '/Copy&Paste END /d' ./firstrun.txt
sudo tail -n +5 firstrun.txt >> config.txt

sudo sysctl -w vm.nr_hugepages=128
sudo nohup ./xmr-stak-cpu > nohup2.out 2>&1&

3) Now I create the blueprint by dragging on a CentOS AWS image that I have installed the vRA agents on and created my own AMI. This will also work on a CentOS 7 vSphere template. I follow on by dragging on the software component created earlier and set the 3 inputs to show in request.
.

4) assign it to a service and configure the catalog

5) Lets now enter the details. pay attention to the worker name. And pick the AWS machine type you want to use and submit.

6) Let check out my pool as see what workers are there.

7) Deployment completed in about 6 minutes and its all a success

Now lets go and check out my pool that i selected and see if the new miner we deployed is actively mining

Woot!! it’s alive!

Any way this was more to do for fun, be awesome if I could do the same with pass through GPU. might have to see if I can get one.

Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Anti SPAM BOT Question * Time limit is exhausted. Please reload CAPTCHA.