AWS Siacoin and Monero Mining

August 5, 2017
AWS cryptocurrencies CloudFormation

TL;DR

Mining Siacoin (SC) and Monero (XMR) simultaneously on any AWS GPU instance today is not profitable even with spot pricing. The only chance you have to maybe make a profit today is if you have a ton of AWS credits to burn and mine a significant number of Siacoin that explodes in value in the future.

BACKGROUND

I had some extra AWS credits and decided to do a POC (Proof of Concept) on mining both Siacoin and Monero cryptocurrencies on a single, GPU and Compute optimized instance—specifically the P2 instances. I’m aware that many before me have already tried mining on AWS but I haven’t seen anyone try to leverage both GPUs and CPUs on a single instance for mining two different cryptocurrencies simultaneously. Also, the fact that AWS recently announced new G3 GPU’s was just too juicy to ignore so I wanted to give those instances test spin.

DISCLAIMER(S)

I’m not an expert on cryptocurrencies nor the algorithms and protocols that power them. This is just a high level, fun project for me to try something different from my daily work. My aim was not to dig into the details but rather to simply answer the question of, “Is it profitable to mine Siacoin and Monero on the same instance using a bunch of spot instances?”

This post is not an endorsement for Siacoin or Monero—I’m simply a hobbyist with a healthy sense of curiosity. As of today, I have not invested any of my own hard earned cash on any cryptocurrency.

It’s also worth mentioning that AWS probably frowns on using EC2 resources for mining so don’t be shocked if AWS smacks you with a policy violation if you try mining—especially with a brand new AWS account. I don’t see any specific mention that mining is prohibited in the AWS AUP (Acceptable Use POlicy) but do read the AWS AUP if you’ve never read it before. So far I haven’t had any issues but my test AWS account is over a year old so that’s probably why.

PERFORMANCE TESTS

I started by selecting GPU instances that already have the NVIDIA CUDA Toolkit installed and do not incur extra software pricing. Here is a link to the g2 and p2 instances that I used for my POC in the AWS Marketplace: NVIDIA CUDA Toolkit 7.5 on Amazon Linux. Unfortunately, these AWS NVIDIA CUDA instances do not support the newer g3 GPU types.

To make sure my tests are consistent, I created a CloudFormation template that you can reference on Github and feedback is of course welcome. I also added the optimizations for p2 instances recommended by AWS in their Optimizing GPU Settings guide.

You can try my CloudFormation stack directly by clicking the Launch Stack button below but be aware that my Siacoin and Monero coin addresses are the default addresses so make sure to change them to your own addresses:

Launch CloudFormation Stack

g2.xlarge

The first test will be on the g2.xlarge instance types. These instances come with 1 GPU, 8 vCPUs, and 15 GBs of memory. If you run the nvidia-smi -L command on the instance you get the following information about the number of GPUs as well as the GPU name:

[ec2-user@ip-172-31-32-110 ~]$ nvidia-smi -L
GPU 0: GRID K520 (UUID: GPU-88edbe85-a510-6797-b31f-36111dae7190)

Not too shabby so let’s see what it can do in the Oregon region (us-west-2) with a spot price of $0.25.

Below are the options that I choose on my CloudFormation template for your reference:

Reference options from virtualjj.com Siacoin and Monero miner CloudFormation template for a g2.xlarge spot instance.

Below are the results of letting the miners run for at least 15 minutes. While it was tempting to SSH into the instance and screen grab the actual miner hashing metrics, I opted not to because it’s the hash rate that the mining pools are calculating that counts.

SiaMining.com g2 Results

I got between 296 ~ 336 MH/s which is probably not much to write home about. Here is a screen grab of the results from siamining.com:

Results for single g2.xlarge spot instance on siamining.com.

XMRPool.net g2 Results

The 8 CPUs on this g2 pumped out an underwhelming 251 H/s. Here is a screen grab of those results:

Results for single g2.xlarge spot instance on xmrpool.net.

p2.xlarge

These instances come with 1 GPU, 4 vCPUs, and 61 MB memory so it will be interesting to see how it fares against it’s older sister the g2.

The nvidia-smi -L command on these p2 instances give you:

[ec2-user@ip-172-31-29-98 ~]$ nvidia-smi -L
GPU 0: Tesla K80 (UUID: GPU-5ab05581-50eb-ee49-2fa6-75eae77c42d3)

For the p2.xlarge instances, the test was exactly the same except that I simply chose p2 instead of g2, create a different worker name, and bump the spot bid price to $0.30. The User data section of the CloudFormation resource has logic in it to apply the AWS recommended GPU optimizations.

eference options from virtualjj.com Siacoin and Monero miner CloudFormation template for a p2.xlarge spot instance.

SiaMining.com p2 Results

The p2’s K80 GPU spit out quite a bit more performance as I got I got between 434 ~ 458 MH/s. Although I had to bid at $0.30 instead of $0.25 the actual spot price was $0.26 so only a cent more expensive.

Results for single p2.xlarge spot instance on siamining.com.

XMRPool.net p2 Results

CPU mining on the p2 was much worse only yielding about 93 H/s. I guess it makes sense because the p2’s only have 4 CPUs where the g2’s have 8:

Results for single p2.xlarge spot instance on xmrpool.net.

To make sure the results were reasonably accurate, I SSH’d into the instance, killed the minerd process, and then started it again manually so I could see what hash rate minerd was showing. It showed a better hash rate but nothing significant:

[root@ip-172-31-29-98 cpuminer-multi]# pwd
/cpuminer-multi
[root@ip-172-31-29-98 cpuminer-multi]# grep -c ^processor /proc/cpuinfo
4
[root@ip-172-31-29-98 cpuminer-multi]# ./minerd -a cryptonight -o stratum+tcp://mine.xmrpool.net:3333 -u 4JUdGzvrMFDWrUUwY3toJATSeNwjn54LkCnKBPRzDuhzi5vSepHfUckJNxRL2gjkNrSqtCoRUrEDAgRwsQvVCjZbS3Pec2368ZCET3XDFN.poc-p2-xlarge-single -p x -t 4

Here is the actual screen grab:

Results of minerd after running it manually from the p2 instance.

g3.4xlarge

I had high hopes for giving this new g3 GPU instance a test drive but unfortunately, there are currently no AWS NVIDIA Linux instances available. If you try to launch an AWS Marketplace NVIDIA instance using g3.4xlarge you get the error message, launchSpecTemporarilyBlacklisted.

This is what the error looks like in the AWS console:

launchSpecTemporarilyBlacklisted error because g3 Linux NVIDIA instances are not available.

The only NVIDIA compatible g3 instances that I could find as of August 5th, 2017 are the Microsoft Windows Server 2012 R2 with NVIDIA GRID Driver instances in the AWS Marketplace. There are also ones for Microsoft Windows Server 2016 with NVIDIA GRID Driver but the spot prices are well over $0.80 an hour for both so I didn’t even bother.

Sigh.

PROFITABILITY

This is where we get to pull out WOLFCALC for Siacoin and Monero. Hold my beer while I do this please…

I’ll start with the best case scenario for Siacoin on the g2 instance at 336 MH/s at a spot price of $0.25. Obviously these variables would fluctuate but it would have to be an incredible fluctuation to matter. Using today’s Siacoin difficulty and price you would lose about $0.241 ($0.25 spot price - $0.009 current Siacoin price) an hour. In addition SiaMining.com requires that you mine at least 500 Siacoins before they will pay out so if you were able to continuously run this spot instance it would cost you approximately $124.48 (500 Siacoins / 0.968 Siacoins an hour) x $0.241 net hourly rate). That’s approximately 517 hours assuming that nothing changes (eg. hashing difficulty, increased spot price, etc.) AND doesn’t factor in the 3% fee charged by SiaMining.com for using their pool. Here is a screen grab from WOLFCALC so you can check my math:

WOLFCALC Siacoin mining profitability results.

The only way that you’d reasonable come out ahead is if you had more than $125 worth of AWS credits, successfully mine 500 coins, and Siacoin increases in value from the current price of $0.00930687 to $0.01.

You’d make about $5 dollars. Excited yet?

Of course there is a possibility that Siacoin might hit $1.00 or more so in that case you might pocket $500 which wouldn’t be terrible, but you wouldn’t be retiring anytime soon. If you had thousands of dollars of AWS credits to burn and Siacoin explodes its possible to make bank but I wouldn’t count on it. Use those AWS credits for something more useful and productive.

As for Monero, the outlook for any profitability is grim. At the best case of 251 H/s (note that’s hashes a second, not KH/s or MH/s) combined with Siacoin mining at the minimum of 517 hours you’d make approximately $8.79 (517 hours x $0.17 Monero hourly rate at 251 H/s). However, as is the case with SiaMining.com there is a payout threshold and for XMRPool.net it can be 0.3 XMR or 3XMR. Assuming the best case here you’d have to be running your instance for 33.3 days (0.3 XMR / 0.009 XMR per day) before you’d even get your 0.3 XMR payout—this isn’t including pool fees either. Using the net hourly rate from our Siacoin mining above at $0.241 it would cost about $192.60 (33.3 days x 24 hours x $0.241) for a whopping $13.24 XMR (0.3 XMR x 44.1284 current Monero price).

Here is my screen grab so you can check my math again:

WOLFCALC Monero mining profitability results.

CONCLUSION

Of course the above calculations aren’t exactly what I would call “precise” but they aren’t necessarily terrible. I’m sure there are many tweaks to squeeze out more performance as well as better mining pools that have better payout options. However, I think from the results we can safely establish that mining on AWS using your own money is not profitable at today’s hashing difficulty for Monero and Siacoin’s market value. There is of course solo mining but that would be a gamble unless you can squeeze out some serious hashing power. Assuming that you don’t get in trouble with AWS you could spin up 20 spot instances in say three regions for a total of 60 total. Assuming a steady spot price of $0.30 x 60 instances, you’d be paying $18 an hour for approximately 2 GH/s (60 spots instances x 336 MH/s rate I observed) which still isn’t going to give you much. At the current hashing difficulty—which appears to have increased while writing this post—sure you’d get about 1,392 SC but that would cost you about $432 (24 hours x $18).

60 spot instances will give you about 1,392 Siacoin in 24 hours.

If you had $500 in AWS credits to burn it might make sense if you think Siacoin will explode in value in the future however, if it were me, I’d save those AWS credits for something more useful and just buy those SC outright (via Bitcoin) for $13.60 (1,392 SC x $0.00977418 today’s SC price). It was fun creating the CloudFormation template for this project and I learned a few new tricks in the process. You might even be able to modify my template to work with a new cryptocurrency in the future and actually turn a profit but be aware that I’m pretty sure AWS doesn’t want their multi-tenant Cloud infrastructure being used for cryptocurrency mining.

Hopefully you enjoyed this post and I like I mentioned before, I haven’t purchased or invested in any cryptocurrency today and the purpose of this post was not to promote Siacoin and Monero nor the miners I used. I do accept cryptocurrency donations however, so if you enjoyed this post and don’t already have a Coinbase account, sign-up using this affiliate link.

If you liked this post please click and say hello!

My Experience Trying to Purchase Siacoin

August 12, 2017
cryptocurrencies Siacoin

New AWS Account Gotcha and a Security Consideration

August 3, 2017
AWS S3 tips security

Mixed Feelings About Static Websites

July 15, 2017
cloud AWS S3 serverless