I want to preface this article by stating that by no means am I anything close to a cryptocurrency expert, I just thought this would be a fun experiment considering I already had a mining computer. I also don’t expect it to be profitable to mine in the cloud, especially because cloud service providers typically regulate what types of instances users can provision using free credits.
My experience with crypto began in mid 2017 when a family friend described profits upwards of $500 USD per month, saying that after initial setup and by using NiceHash, there was easy money to be made.
Curious about the prospect of mining (I had heard a lot about how magical crypto and blockchain were), I began to do research into how to build a so called “mining rig”. As somebody who has always had a strong interest in computers, I was excited at the possibility of building my own computer. After a reasonable amount of online research, I ended up going to the local MicroCenter and purchasing the following hardware:
- 2 x Gigabyte GeForce GTX 1080 Ti 11GB
- 1 x ASUS ROG GeForce GTX 1080 Ti 11GB
- 1 x EVGA GeForce GTX 1060
- 1 x Gigabyte GeForce GTX 1070
- 1 x ASUS TUF Z270 Mark 2 Motherboard
- 1 x Corsair RM850x PSU
- 1x Cooler Master V850 PSU
- 1 x ISPG 120 GB SSD
- Intel Core i3 7th Generation CPU
- HyperX 8GB DDR4 RAM
Putting the computer together went fairly smoothly and after setting up
Windows and installing NiceHash, I was ready to mine. (I made the decision to mine on NiceHash because it eliminates the need for the user to micromanage which algorithms to mine by offering a platform in which users can buy/sell hashing power. This model fit my schedule better — I set the miner up at home during my winter holidays and would be at school for the next few months.)
The first few months led me to be optimistic — I was worried that I got into mining too late but daily profits of 20–25 dollars helped put my fear to rest. However, by mid-2018 daily profits shrunk to around 3–5 USD daily. The value of Bitcoin, the currency NiceHash pays out in, was down the toilet, and it didn’t seem worth it to mine any more. I ended up shutting down the mining rig, thinking about using it for other things, like training Machine Learning models, and waiting for a good time to start mining again.
In late June (2019), the value of Bitcoin reached over $13,000 USD, piquing my interest. I began to wonder if it would make sense to start mining again. Looking at NiceHash’s profitability calculator, I saw that my hardware was profitable, so I fired up the miner and let it work for a few days. In the limited sample size I have (3 days), the miner is making .00045 BTC a day (~$5 USD). While it’s not making anything close to what it used to, it’s still profitable. On premises mining, although obviously dominated by ASICs for cryptos like Bitcoin, does seem profitable.
One point I want to touch on briefly is that of heating. With on premises hardware, whether ASIC, or traditional computer using GPUs, the hardware will spit out noticeable amounts of heat. In the warmer months the money spent cooling the hardware/your home is something that needs to be factored into profitability calculations along with electricity costs. However, in the winter it can make sense to run the miner and make some money while also heating your home. (This is not an exaggeration, the mining rig I use makes the basement of my home significantly warmer, sometimes uncomfortably so. If you are using an ASIC or a higher powered mining rig I would guess that your heating costs in the winter would be offset very nicely.)
After finishing this section of the article I realized that I was mining with NiceHash Miner 2, a no longer supported platform. NiceHash suggests switching to their other mining platform, the NiceHash Legacy miner. After switching platforms and fixing the GPU configuration (GTX 1060 was disconnected), the daily profits jumped up closer to ~$10 USD daily, which pays for its electricity as well as makes a small profit.
Cloud Based Mining
I am relatively new to using cloud technologies (less than a year of experience) but I have wholeheartedly jumped on the bandwagon. Cloud service providers like Amazon Web Services (AWS) and Microsoft Azure are changing the way the tech industry works. Gone is the age in which technical architects had to guess how much infrastructure a project needs. Now, using online portals, users can provision massive amounts of computing power at the click of a button. Both Azure and AWS have a wide selection of services available, making it easy to design and implement solutions for anything ranging from analyzing IoT data to provisioning a server to allow students to learn how to code in the same development environment.
Both Azure and AWS offer users a significant amount of free benefits when creating a new account. Azure offers users $200 USD in free credit along with additional free resources, while AWS offers users many free resources, like access to 750 hours of compute on an EC2 (Elastic Cloud Computing) instance.
I am more familiar with Azure than AWS, so I decided to conduct my experiment in Azure. I wanted to see if I would be able to turn that $200 USD in Azure credit into anything near that in BTC payout.
When provisioning virtual machines on Azure using the free subscription, users are only able to access a limited amount of the VM sizes. Users are also constrained by a limit of 4 cores per region, leaving me with not too many viable options for mining. After some quick research I decided that the compute optimized F4s would be optimal for me.
After a reasonably quick install and configuration of the miner, it was up and running. Benchmarking of the CPUs was far quicker than expected, finishing in a minute or two. I let the miner run for 2 days to get a good sense of what the average BTC payout would be.
The resulting average for the cloud based miner was disappointing to say the least. Mining with the F4s size resulted in a payout equivalent to $.08 USD on average, not profitable at all if I was paying for the VM with real money and not free credit. However, in the case that you have Azure credit and a full, not free trial subscription, it could make sense to mine with multiple VMs.
I also tested a configuration using two separate VMs, each size F2s. This configuration was an epic failure, with one of the VMs running the CryptoNight V8 algorithm at a speed of 0 H/s and the other throwing errors and crashing when the script to mine began to execute.
It also is probably worth doing research into more optimal mining configurations if you have access to the full set of Azure Virtual Machine sizes. Just because the F2s and F4s sizes proved to be suboptimal doesn’t mean there aren’t sizes that could be profitable. In particular, it would be interesting to see if the higher powered VMs with multiple/better GPUs could net a profit. Default Azure pricing for VMs (on demand or pay-as-you-go) may still be too expensive to make this a viable option, but the ability to provision spot instances in batch jobs could provide a substantial enough discount to make it worthwhile.
Contrary to what you may of heard, in the current market it can still be profitable to mine cryptocurrency. By no means is it going to be as profitable as it would’ve been even 2 years ago, but if you already have the hardware in place it can make a lot of sense. For those of you living in colder climates that profitability could also end up being twofold, earning you cryptocurrency while also cutting your heating costs.
Mining in the cloud probably isn’t the best use of free trial credits if you have a free trial subscription for Azure. At the rate my credits were being consumed I think the $200 USD would be consumed before I made $1 USD. Those credits could instead be used for any countless other things, such as hosting a website or leveraging more compute power to train a machine learning model.
As far as extensions, I may look to come back and play with other more expensive sizes in Azure (I’m planning on buying a pay-as-you-go subscription sometime in the near future anyways, so it looks like it could be interesting to spin up a gpu-enabled VM for a couple of hours and let it run).
Setting Up Virtual Machine
The process of setting up the VMs was fairly simple, I’ve included directions below incase any readers are interested in trying for themselves. These instructions are intended for people using MacOS, but it should be fairly simple to complete even if you use a different operating system.
- Create a Microsoft Azure account
- Ensure you have the Azure CLI installed and working. For Mac users you can use run the following commands in Terminal if you have Homebrew installed, otherwise follow the instructions in the Azure Documentation. The first command ensures you have an up to date version Homebrew and installs the azure-cli package. The second command is used to verify your installation works correctly.
brew update && brew install azure-cli
3. Run the command to login to Azure in your terminal. Follow the prompts in the terminal, and enter your login credentials into the window that pops up. After you login, information about your subscriptions will be printed to the terminal.
4. Use the Azure CLI to provision a VM with the correct configuration. The scripts/Azure Resource Manager (ARM) templates are in this Github repository. Download the repo and read over/run the script deployf4s.sh with the command below.
Note that we choose to provision VMs imaged with Windows, not Linux. This is because NiceHash is currently only available on Windows. If you want to use a Linux virtual machine you will have to download one of many other options for mining software that runs on that platform.
5. Once your deployment is completed successfully, all thats left to do is connect to the VM and start mining! I used RDP because its easy but you can feel free to use SSH instead. If using a Mac and you wish to use RDP you will have to download the Microsoft Remote Desktop client from the Mac App Store before you can connect. Double click the .rdp file and the client will prompt you for credentials.
6. After you are logged in, open up Internet Explorer and make sure that downloads are enabled. You will want to first open the internet settings and navigate to security.
You will then want to click custom level and set the allow downloads property to available.
Press OK then apply your changes and close the window.
7. Paste the following link into Internet Explorer
8. Save the .zip file to your downloads and unzip it. Run the .exe file — NiceHashMinerLegacy.exe. You may run into some issues with Windows Defender, follow the directions on the NiceHash website to get around that.
9. Login/Register with NiceHash and start mining!