Is Mining Litecoins on AWS EC2 Profitable? Part 1: CPU Mining

With the value of Bitcoins soaring to record highs, hitting USD 1,242 on 29 Nov 2013, many might be tempted to join in the gold rush of Bitcoin mining. But the competition is fierce, and the difficulty level has risen to a level that makes Bitcoin mining unprofitable for most except those with highly specialized equipment.

Enter Litecoin, the silver to Bitcoin’s gold, which similarly rose to a record USD 48.48 on 28 Nov. Unlike Bitcoin, which uses the SHA256 algorithm that requires specialized hardware called ASICs for maximum performance today, Litecoin “uses a memory-hard, scrypt-based mining proof-of-work algorithm to target the regular computers and GPUs most people already have.” In other words, it is designed for people with commodity high-performance CPUs and GPUs to participate in. What if you do not have a high-performance CPU or graphics card to mine Litecoins with? How about renting them, say from Amazon Web Services (AWS)? In this two-part series, I shall examine whether it is profitable to mine Litecoins with CPUs and GPUs rented from AWS.

Let us begin by mining Litecoins with CPUs. AWS is a cloud computing company that provides computing resources for rent by the hour. This is perfect for an experiment like this, to find out if it is profitable before sinking more money into mining hardware. Amazon’s Elastic Compute Cloud (EC2) offers different configurations of virtual computing instances. For the purposes of Litecoin mining, we want EC2 instances with the maximum CPU power available. At the moment, these would be the c3.8xlarge Compute Optimised instances that come equipped with 32 virtual CPUs (which are hardware hyperthreads from 2.8 GHz Intel Xeon E5-2680v2 (Ivy Bridge) processors) and 60 GB of RAM. For this test, we will rent these as Spot Instances, which cost about $2.00 per hour at the moment.

Prerequisite: AWS Account and Litecoin Mining Pool

Before we start, we need to already have an AWS account, and join a Litecoin mining pool. Popular pools are WeMineLTC and Give Me Coins. Set up a mining worker in your pool, and take note of the URL, worker name and worker password. Choose a port 80 URL if possible (e.g. ltc.give-me-coins.com:80) to avoid having to configure any firewall rules or AWS Security Groups for now.

1. Set up c3.8xlarge Spot Instance on Amazon EC2

Go to the EC2 Management Console, then click on Spot Requests on the left, then Request Spot Instances. You will be asked to choose an Amazon Machine Image (AMI). The code below is for the Ubuntu Server 13.10 (64 bit) AMI, but you can choose another AMI if you know how to set it up.

Next, choose the Compute optimized instance of type c3.8xlarge, and configure it with the following:

  • Number of instances: 1
  • Purchasing option: check Request Spot Instances
  • Maximum price: the maximum price you are willing to pay for the instance. A good rule of thumb is to use the current price shown on the screen, or slightly more. At the time of writing, c3.8xlarge Spot Instances were going for about $2.00.

You can use the default values for the other fields, or customise them if you are familiar with Amazon EC2.

Once you have configured the instance, click Launch. A dialogue box will appear, asking you to select or create a key pair. If you have already created an Amazon EC2 key pair, you can select it from the dropdown list. Otherwise, select Create a new key pair, enter a name for it (for example, “LTC”) and click Download Key Pair. You will get a file like LTC.pem, which contains the private key you will need to log in to your new server.

Wait a few minutes, and if your Spot Request was fulfilled successfully, you should see a new running instance in the Instances section of the EC2 Management Console.

2. Set up Required Software

Log in to your newly instantiated server using SSH. Windows users can use PuTTY. You will need the public URL of the server, which you can find from the EC2 Management Console (it will look something like ec2-xx-xx-xx-xx.yyy.compute.amazonaws.com).

chmod 400 LTC.pem
ssh -i LTC.pem ubuntu@INSTANCE_PUBLIC_URL

Upgrade preinstalled packages (optional):

sudo apt-get update
sudo apt-get upgrade

Install required packages:

sudo apt-get install build-essential libcurl4-openssl-dev
wget http://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.3.2.tar.gz
tar -xzf pooler-cpuminer-2.3.2.tar.gz
cd cpuminer-2.3.2/
./configure CFLAGS="-O3"
make

3. Start Mining

Here is where the fun begins. Start minerd, using the pool URL, worker name and worker password from above:

./minerd --url=stratum+tcp://POOL_URL --userpass=WORKER_NAME:WORKER_PASSWORD

You should see output resembling this:

[2013-12-01 15:17:35] Binding thread 1 to cpu 1
[2013-12-01 15:17:35] Binding thread 3 to cpu 3
[2013-12-01 15:17:35] Starting Stratum on stratum+tcp://ltc.give-me-coins.com:80
[2013-12-01 15:17:35] Binding thread 4 to cpu 4
[2013-12-01 15:17:35] Binding thread 5 to cpu 5
[2013-12-01 15:17:35] Binding thread 13 to cpu 13
[2013-12-01 15:17:35] Binding thread 16 to cpu 16
[2013-12-01 15:17:35] Binding thread 10 to cpu 10
[2013-12-01 15:17:35] Binding thread 12 to cpu 12
[2013-12-01 15:17:35] Binding thread 7 to cpu 7
[2013-12-01 15:17:35] Binding thread 0 to cpu 0
[2013-12-01 15:17:35] Binding thread 28 to cpu 28
[2013-12-01 15:17:35] 32 miner threads started, using 'scrypt' algorithm.
[2013-12-01 15:17:35] Binding thread 18 to cpu 18
[2013-12-01 15:17:35] Binding thread 11 to cpu 11
[2013-12-01 15:17:35] Binding thread 21 to cpu 21
[2013-12-01 15:17:35] Binding thread 6 to cpu 6
[2013-12-01 15:17:35] Binding thread 24 to cpu 24
[2013-12-01 15:17:35] Binding thread 25 to cpu 25
[2013-12-01 15:17:35] Binding thread 27 to cpu 27
[2013-12-01 15:17:35] Binding thread 15 to cpu 15
[2013-12-01 15:17:35] Binding thread 29 to cpu 29
[2013-12-01 15:17:35] Binding thread 30 to cpu 30
[2013-12-01 15:17:35] Binding thread 31 to cpu 31
[2013-12-01 15:17:35] Binding thread 19 to cpu 19
[2013-12-01 15:17:35] Binding thread 22 to cpu 22
[2013-12-01 15:17:35] Binding thread 14 to cpu 14
[2013-12-01 15:17:35] Binding thread 8 to cpu 8
[2013-12-01 15:17:35] Binding thread 9 to cpu 9
[2013-12-01 15:17:35] Binding thread 2 to cpu 2
[2013-12-01 15:17:35] Binding thread 23 to cpu 23
[2013-12-01 15:17:35] Binding thread 17 to cpu 17
[2013-12-01 15:17:35] Binding thread 26 to cpu 26
[2013-12-01 15:17:35] Binding thread 20 to cpu 20
[2013-12-01 15:17:43] thread 1: 4104 hashes, 4.54 khash/s
[2013-12-01 15:17:43] thread 4: 4104 hashes, 4.54 khash/s
[2013-12-01 15:17:43] thread 3: 4104 hashes, 4.53 khash/s
[2013-12-01 15:17:43] thread 13: 4104 hashes, 4.53 khash/s
[2013-12-01 15:17:43] thread 10: 4104 hashes, 4.53 khash/s
[2013-12-01 15:17:43] thread 5: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 7: 4104 hashes, 4.53 khash/s
[2013-12-01 15:17:43] thread 18: 4104 hashes, 4.53 khash/s
[2013-12-01 15:17:43] thread 16: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 12: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 11: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 28: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 0: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 29: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 24: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 25: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 6: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 21: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 27: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 17: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 20: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 2: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 15: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 30: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 19: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 23: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 9: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 26: 4104 hashes, 4.52 khash/s
[2013-12-01 15:17:43] thread 8: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 31: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 22: 4104 hashes, 4.51 khash/s
[2013-12-01 15:17:43] thread 14: 4104 hashes, 4.51 khash/s

Results

With this set up, minerd achieved an average of 144 KH/s across all 32 CPUs:

[2013-12-01 15:18:18] accepted: 4/4 (100.00%), 144.63 khash/s (yay!!!)

Will this make any profits? A quick calculation using the Mining Calculator at litecoinpool.org makes it clear that it will not, given the current network difficulty, LTC/USD exchange rate and price of EC2 Spot Instances (by setting Power usage to 1,000 W, we can plug in the hourly cost of the EC2 instances in Energy cost):

Litecoin Mining Calculation for CPURenting CPU time from Amazon EC2 to mine Litecoins is clearly not profitable unless the LTC/USD exchange rate soars even higher, or the price of Spot Instances falls sharply, or both. As more Litecoins are mined and the difficulty increases, it will become increasingly difficult to find a lucrative proposition for mining Litecoins using CPUs. If you have a computer with CPU time to spare, try mining some Litecoins and see if it is profitable for you, taking into account your electricity costs. Otherwise, it will probably not be worth investing money to buy or rent new hardware.

In Part 2, we will investigate the mining performance of GPUs on Amazon EC2.

Advertisements

5 thoughts on “Is Mining Litecoins on AWS EC2 Profitable? Part 1: CPU Mining

  1. Large transactions, maybe $10,000+ you would wait for 6 or more confirmations to be sure. Say you buying that Tesla for $100,000 using bitcoin, It would probably take longer to fill out all the paperwork than the time it would take the 6 confirmations to go through.

  2. Matt Halligan says:

    After following the steps I have received a JSON decode fail (1) where ” [ ” or ” { ” is expected near HTTP. After searching for an answer on the internet I havent come across anything useful in solving the issue. Do you have any ideas?

  3. Morris Joseph says:

    This post look interesting. i think mining litecoins using the 12 months free package of amazon aws ec2 instance for windows.

    Don’t you think so?

    if i setup the 12 months free package of amazon aws ec2 instance for windows with my credit card can’t i mining litecoin with profit. it means i get $2.74 on every 24 hours.

    What is your intake in this or can’t i mining with the free package of amazon aws ec2?

    • Matt Halligan says:

      I’m doing this just for fun but I have the error mentioned above. At the time of the post the author had 32 cores working, free version gives you one core(1/32 of the performance in the article) difficulty of mining has increased meaning even less performance. It comes out to about 0.02$ USD per year. Pretty much useless but interesting to set up

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s