Using Amazon EC2 to mine Dogecoin

Or, how I spent $15.60 to get 4196 dogecoin (worth $1.81 $6.51!)

Over the holidays I mined dogecoin using an Amazon AWS cluster compute box. My goals were as follows:

  • to learn about cryptocurrencies in more depth,
  • to learn how to mine them,
  • to prove out AWS GPU compute instances as a viable mining platform.

TL;DR: I mined dogecoins using an AWS GPU instance. I spent $15.60 on the instance to get $1.81 $6.51 worth of dogecoins. This guide is meant to help you understand the mechanics of applied mining using EC2, not to get rich.

Update: 1 month after initially writing this draft, I have revised my opinion about using AWS to mine dogecoin. It may be profitable to mine (bit|lite|doge)coin using AWS, but only if the value of that coin goes up. So, for instance, if the value of dogecoin exceeds $15.60, I will have made a profit. Additionally, the price for spot instances over the holidays was insane, something around $6.00/hr, which is nearly 10x the normal reservation cost. As of this writing the cost of a spot instance is 0.23/hr.

Still, there’s no guarantee that will happen. My intentions with this project were not to gain a profit, but to gain a better understanding of how mining works, what the tools are, and as an excuse to fire up a beefy GPU instance for 24 hours.

Below are my takeaways.

Why dogecoin?

I didn’t really have a good reason to choose dogecoin, other than it was cheap, easy to mine given the difficulty, and has a community that does not take itself seriously. This was a learning endeavor, and given my non-seriousness about the whole thing, dogecoin fit the bill nicely.

Even though dogecoin has a lighthearted air to it, it is indeed a full-fledged cryptocurrency, based upon litecoin that uses scrypt as the proof-of-work algorithm.

Choosing the right hardware

First off, you’ll want to choose the right hardware. Amazon offers 2 types of GPU instances, the cg1.2xlarge and the more current g2.2xlarge. Given that the cg1.2xlarge is more than 3 times the running cost of the g2.2xlarge, we’ll be focusing on running the cheaper g2.2xlarge for mining.

The g2.2xlarge instance has a single NVIDIA GRID GPU (Kepler GK104), which offers okay performance. I was able to max out at around 250Kh/s after a bit of tuning. The instance also has 8 cores, so you can use all 8 to add about 10-12 extra Kh to that number.

A note on spot instances

“Spot instances” are instances that potentially are much cheaper to to run than the standard sticker price. A normal reservation of a g2.2xlarge instance is $0.65/hr. However, you can bid on a “spot” instance, where your instance will continue to run as long as spot price is under your bid price.

Sometimes this makes a lot of sense. Spot instance pricing, however, has a tendency to wildly fluctuate all over the place, as demonstrated in the picture below:

wild

As you can see, the price was around $6/hr (!!!) for Jan 17-19, and then came down significantly after that. Furthermore the trend line does not really follow any sort of pattern whatsoever. There are many theories about why spot instance pricing is so volatile.

At the time of this writing, spot instances in the us-east-1d region are trending at 0.23/hr for a g2.2xlarge instance. This is much cheaper than the normal running rate of 0.65/hr.

Choosing the right AMI

The best AMI I have found for mining is ami-9f6150f6, which has a description of “SuchMiner - doge to the moon”. Seems fitting.

Using the AWS instance launch tool, choose search for ami-9f6150f6 in the community ami tab:

Then, be sure to choose the g2.2xlarge instance:

Go to the next step, “configure instance details”, and request spot instances, if they are below the normal running price ($0.65/hr at time of writing)

In the screenshot above, you can see that the current price in us-east-1d is $0.26/hr, so I set my maximum price to 0.27. Granted, if the price moves upwards at all, my instance will be terminated, but I can always fire up another once the price comes down.

Now you are ready to launch your instance. Click “Review and Launch”, then “Launch”.

Let the mining begin

Once the instance is up, ssh into the machine and configure your mining details. I happen to like dogecoin so I have set up cudaminer.json and cpuminer.json to mine from http://pool.dogechain.info

$ cat cudaminer.json
{
"url" : "stratum+tcp://pool.dogechain.info:3333",
"user" : "gammons.worker",
"pass" : "mypass",

"algo" : "scrypt",
"threads" : "1"
}

$ cat cpuminer.json
ubuntu@ip-10-184-83-88:~$ cat cpuminer.json
{
"url" : "stratum+tcp://pool.dogechain.info:3333",
"user" : "gammons.worker",
"pass" : "mypass",

"algo" : "scrypt",
"threads" : "8"
}

After setting up your json files, restart both cpuminer and cudaminer:

sudo restart cudaminer
sudo restart cpuminer

And then, sit back and watch the mining happen!

$ sudo tail -f /var/log/upstart/cudaminer.log /var/log/upstart/cpuminer.log
==> /var/log/upstart/cudaminer.log <==
[2014-01-23 04:53:34] GPU #0: GRID K520, 233.86 khash/s
[2014-01-23 04:53:34] accepted: 2/2 (100.00%), 233.86 khash/s (yay!!!)
[2014-01-23 04:54:24] Stratum detected new block
[2014-01-23 04:54:24] GPU #0: GRID K520, 234.27 khash/s
[2014-01-23 04:54:28] GPU #0: GRID K520, 226.73 khash/s
[2014-01-23 04:54:30] accepted: 3/3 (100.00%), 226.73 khash/s (yay!!!)
[2014-01-23 04:54:54] GPU #0: GRID K520, 233.79 khash/s
[2014-01-23 04:54:54] accepted: 4/4 (100.00%), 233.79 khash/s (yay!!!)
[2014-01-23 04:54:55] GPU #0: GRID K520, 211.18 khash/s
[2014-01-23 04:54:55] accepted: 5/5 (100.00%), 211.18 khash/s (yay!!!)

==> /var/log/upstart/cpuminer.log <==
[2014-01-08 23:53:09] thread 3: 349188 hashes, 5.36 khash/s
[2014-01-08 23:53:19] thread 6: 470604 hashes, 5.81 khash/s
[2014-01-08 23:53:35] thread 0: 322320 hashes, 5.04 khash/s
[2014-01-08 23:53:45] thread 2: 360732 hashes, 6.49 khash/s
[2014-01-08 23:53:55] thread 1: 340596 hashes, 5.53 khash/s
[2014-01-08 23:53:56] thread 5: 328764 hashes, 5.34 khash/s
[2014-01-08 23:53:58] thread 3: 321336 hashes, 6.55 khash/s
[2014-01-08 23:54:00] thread 4: 301188 hashes, 5.01 khash/s
[2014-01-08 23:54:01] thread 4: 5736 hashes, 5.02 khash/s
[2014-01-08 23:54:01] accepted: 844/844 (100.00%), 39.78 khash/s (yay!!!)

At your mining website, you should notice that your miners are registered and working:

Saving a copy of the AMI

At this point you’ll want to save your own copy of the AMI, so that you don’t need to reconfigure it if you launch another instance of it.

In the instances tab, right-click the instance, and click “create image”.

Then give your new AMI a name and description, and click “Create image”.

Note that your running instance will be terminated when you do this, so be sure to start up another one if you want to continue mining!

Profit?

Profit was not the main goal of this experiment. However it was kind of interesting to see that my 4200 dogecoin increased in price nearly 4x, from $1.81 to $6.51. But we’re talking about sums that could barely buy me a sandwich, and I’m still very much in the red from my initial costs.

Is it conceivable that my 4200 dogecoin may someday be worth more than $15? Possibly. In which case, I will have broken even. Yaay!

This entire experiment was more of an educational experience about the applied side of mining.

Want more?

Join my mailing list to receive a monthly newsletter about software design.


No spam, ever. Unsubscribe at any time.


comments powered by Disqus