/ Azure

Ethereum mining in Azure

Before reading: mining any crypto currency in Azure is a verry bad idea! This article explains why

Update: posted a new blog about optimizing your miner here.
Update 2: I have reports that this is being actively blocked by Azure. This was always intended for testing purposes not for actual production mining

Lately my colleagues have gone wild over this 'better than Blockchain' crypto currency named Ethereum (Ether). So here are my findings on how you can mine it in Azure.

What is Ethereum?

Like Bitcoin Ethereum is a crypto currency. This means you can make secure payments to anyone in the world, without a centralized bank to process the payment. Because there is no single point of failure and the encrypted nature of the transactions this is a very secure form of payment.

Difference with Blockchain:

  • Ethereum is not only a public crypto currency, it is also offers you the possibility to create your own private chain. This makes it possible to easily make a secure and trustable system of transactions with your own group of people / entities.

  • It is way more than a currency. Ethereum allows you to write Smart Contract. These contracts can describe anything from a voting system or auction system to a custom payment model. Because each transaction is stored in the public or private chain, these can not be altered later.

How to setup a GPU miner in Azure

A cool Azure feature since the beginning of late 2016 is GPU Virtual Machines, these offer both M60 and K80 NVIDIA GPU's. Since that moment I have always wanted to use it but never got to it until now.

So, let's get started. As OS I am using Ubuntu 16.04, because this OS does not have the proper drivers for GPU mining. We need to install these - check the Microsoft docs here for the latest commands to setup the drivers.

After installing let's install the mining software like this:

#Add the ethereum repository and update  apt-get
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update

#Install the Ethereum resources

sudo apt-get install ethereum ethminer geth

Making a hard decisions

So before you start mining, you have to make the decision if you want to mine on your own or join a 'Pool'. When you join a Pool, you will be mining together with other people in the Pool on a certain block. The chance you will find a block will be higher than when you mine solo. The disadvantage is that you will pay a fee to the pool, this is mostly 1%-2% of your revenue, so I think it is worth this.
Let me show you how to get started with pool mining. In this example I am using a pool named 'Dwarfpool', but there are tons of others out there.

# Start mining 
# -G for GPU mining which we want
# -F for farm mining with the end point of your farm
ethminer -G -F http://eth-eu.dwarfpool.com:80/YOUR_WALLET

# Example (my wallet for donations ;), tnx)

ethminer -G -F http://eth-eu.dwarfpool.com:80/0x8e9137Fa982C0Af6EF94D0f7A15dafaCB6EAb725

Cool, you are mining!!!

But wait a minute...
It's cool and all, but......

Was it worth it?

The big questions obviously will be whether it was worth it, how much did I spend and how much did I make? Before answering, let me show you the possible GPU machines:

VM name CPU Cores RAM GPU
NV6 6 56 1x M60
NV12 12 112 2x M60
NV24 24 224 4x M60
NC6 6 56 1x K60
NC12 12 112 2x K60
NC24 24 224 4x K80

While using a NV6 Machine with a single GPU I got an average of 22 Mega Hashes per second, at the time of writing according to cryptocompare.com that yields me $4.90 per day, given that the VM costs about $1.37 per hour, so $32.88 per day. This unfortunately is not useful at all :(.

Of course, this leads everyone to the following question:

"Are these instances with multiple GPU's effective?"

How do GPU's scale when mining Ethereum?

Most miners do have a multi GPU setup, so I guess this would work, but the main question will be: "will it work so well that it becomes profitable?".

Let's first look at the raw performance of each instance here; it looks to be scaling quite well.
GPU scaling

Finally let's take a look at it with numbers:

Model mhs Price per hour Eth per hour in $ Gain/ loss per hour VM price coverd
NC6 14.56 0.759 0.106 -0.653 14%
NV6 21.99 0.922 0.161 -0.761 17%
NC12 32.15 1.518 0.235 -1.283 15%
NV12 39.34 1.843 0.288 -1.555 16%
NV24 73.86 3.686 0.541 -3.145 15%

Looking at the table, only 17% of the price is covered at best. This means that mining in Azure for the public Ethereum chain is not worth it.

If you have a private chain and you need to have a lot of power behind it, this is a great solution.

Extra information

CPU Usage

Why are you talking about CPU, you might ask? While biking home, I wanted to finish this article by writing that it is such a waste of resources when you have up to 24 cores and you are not even using one fully. So I thought: why not spin up another ethminer process for all the CPU resources?
So I did with forcing the miner to use CPU only like this:

ethminer -C -F http://eth-eu.dwarfpool.com:80/0x8e9137Fa982C0Af6EF94D0f7A15dafaCB6EAb725

Cool! When I look at my htop, all CPU cores where used for the full 100%. So now I'm done, right?
Unfortunately, not completely. When I was looking at my GPU utilization which used to be roughly 100%. Now, it had dropped to 70%-80%, which sucked!
Therefore I changed the priority of the GPU process via renice more info about that here, now my cpu is running at full speed and all my cores are as well.
Result: almost none. The CPU's were powerful enough to submit any jobs, so the number of mhs of the rig did not improve at all :(.

Vincent van Wingerden

Vincent van Wingerden

I work for Microsoft as Technology advisor on the area of big data and advanced analytics. When I have made another cool demo I hope to write about it here. All opinions are my own

Read More