Category Archives: litecoin

An Experiment in CryptoCoin Mining Featuring RasPis – The Results

So in my last post, I wrote about the setup of my little CryptoCoin mining experiment, and in this post I am presenting the results.  But before I jump into the results, I want to discuss some of the assumptions and biases of this experiment:

Bitcoin and Litecoin both adjust the difficulty of their proof-of-work problems in order to throttle the mining process and keep the additions to the block chain occurring at a regular, predetermined rate.  The difficulty changes frequently, and over the course of the experiment, the difficulty for both Bitcoin and Litecoin increased significantly.  This means that the rate of coin mining most likely got a good deal slower as the experiment progressed. Unfortunately I did not collect interval data, I only have overall results, so I cannot quantify the impact (would make an interesting follow on, perhaps I will do it later).  If you attempt to recreate this test, your results will vary significantly due to this issue.

In addition to the variable difficulty, each mining pool has it’s own issues.  Both mining pools would go down from time to time (this is pretty common).  Unfortunately, when the Bitcoin pool would go down, the miner on the RasPi would shutdown. I did my best to check regularly and restart the miner (apparently there are ways to have the miner automatically switch to a backup pool), but there were definitely a few times when it went down for more than a day.  The impact is probably in the range of 10-20%, meaning had I taken better measures to protect against downtime, I most likely would have seen an increase in Bitcoin returns by 10-20%.

The final consideration to make, is that the value of the respective coins is constantly changing.  I used $127.53 for Bitcoin and $2.86 for Litecoin.  These were the prices of the coins on the day I stopped the experiment.  The exchange rates vary wildly, and as such, your results will depend heavily on the current exchange rates.

So let’s get down to it.  The experiment lasted 42.1 days (I let the miners run for a bit longer than I initially had planned).  The following table presents the number of coins mined and the dollar value of those coins:

results1

So as was expected, the RasPis mined much more Litecoin than Bitcoin over the course of the 42 days.  This is due to the popularity, and subsequently difficulty, of mining Bitcoin.  Interestingly enough, while we mined 2x orders of magnitude of Litecoin, due to the exchange rates of the coins, the monetary value of the coins was much closer.

Another factor that needs to be taken into account is the cost of electricity.  While, I am currently using the RasPis as servers and development/test boxes, if I wanted to use the RasPi as a dedicated mining rig, than I would need to adjust the returns for the cost of electricity required to run the device (while RasPis are really low powered, if you were running a dedicated GPU rig, electricity costs would be a very important factor to consider).  After digging around on the internet I came up with a rough estimate of the energy consumption of a RasPi.  Interestingly enough, the RasPi seems to have fairly stable power consumption regardless of the amount of processing it is doing (a testament to the efficiency of the ARM processors?).  I rounded the power consumption up to 3 watts (from 2.5) to keep things conservative.  Below is a breakdown of the costs, the electricity rate was pulled from my latest utility bill:

results2

And here is the electricity adjusted returns of the mining operation:

results3

 So as you can see, accounting for electricity costs, the miner operations for both Bitcoin and Litecoin resulted in negative returns.  As I mentioned, I have the RasPis up and running for other reasons anyway, but regardless, the number of coins mined are so small that the gains are entirely swamped out by electricity costs.  Just to break even, you would need Bitcoin to increase in value to ~$1950 and Litecoin to increase in value to ~$17.35.  And of course, that is assuming the mining difficulty stays relatively constant, which it most assuredly won’t if the exchange rate rises to those levels.

So in conclusion, if you were hoping to set up a Raspberry Pi CryptoCoin mining rig in order to retire early, I would recommend reconsidering, or at least keep your day job!  But if you have some Raspberry Pis up and running anyway, and want to play around with some of the mining software that is out there, than this is a good way to get into the game with out risking the security of your main computer (there are some pretty sketchy operators in the CryptoCoin space, so take precautions).

An Experiment in CryptoCoin Mining Featuring RasPis – The Setup

So while in Costa Rica for a surf trip, I thought it would be a fun project to run a little cryptocurrency mining experiment.  I have been playing around with a few Raspberry Pis for a while now, and out of curiosity decided to set them up as cryptocurrency miners.  Anyone who has been following the Bitcoin (BTC) craze as of late, and has a rough idea of how the mining process works, would know that using a Raspberry Pi as a Bitcoin miner is like bringing a knife to a gun fight (actually it is more like bringing a toothpick to a gun fight).  But considering I was going to be out of the country for two weeks with limited internet, I figured I might as well put the Raspberry Pis to some use.  After doing a little research, I decided to simultaneously run two Raspberry Pis as cryptocurrency miners, one mining Bitcoin, the other Litecoin, and after a few weeks of run time, evaluate and compare the rate of return on the two mining operations.

For this post, I am going to provide a quick background on the two coins and what this experiment will demonstrate.  I will write a separate follow up post with the results later.  There has been plenty of press on Bitcoin in the last month, so I won’t go into too much detail about what Bitcoin is, but for those who are not aware, there are also a number of alternative currencies in existence.  One of those currencies is called Litecoin (LTC).  The advocates of Litecoin advertise the project as ‘the silver to Bitcoin’s gold’.  Litecoin is one of a handful of alternative coins that has gained enough traction to get off the ground and it appears to be the most adopted of the alternative currencies.  The code for Litecoin was based on the Bitcoin protocol, but modified in a few ways to compensate for some of Bitcoin’s perceived shortcomings.

The primary difference between Bitcoin and Litecoin is the hashing algorithm used in the ‘proof of work‘ phase.  Bitcoin and Litecoin mining are done by solving complex problems called proof of work.  These proof of work problems are designed to require a fair amount of computing power to solve, however they are easily verifiable, so once a solution is found, it is easy for the network to verify that the solution is valid.  This is done by requiring miners to randomly seed a hashing algorithm until they get a certain output.  Once the appropriate seed value is found, the solution can be verified by others by simply using the solution seed and running it through the hashing algorithm to check that you get the appropriate output.

For those that aren’t familiar with hashing algorithms, a good analogy to this process is brute-force password cracking (i.e. randomly trying to guess someone’s password).  In order to guess someone’s password, you would have to try thousands upon thousands of iterations, but once the correct password is found, it is very easy for someone else to verify that you have found it.  The time it takes to find the correct password is fairly random, i.e. it is possible that you could guess it correctly on the first attempt, or it could take you millions of attempts.  Adding computing power to the problem will speed up the number of attempts you can make, but it does not guarantee that any individual attempt is more likely to succeed.

With Bitcoin and Litecoin mining, individual miners compete against each other to find the solution to the proof of work problem.  The first node that correctly finds the solution is rewarded with a number of coins.  Adding computational power to you miners increases the odds that you will find the solution first, but because of the randomness involved in the process, it does not guarantee that you will be the first to solve a particular proof of work.  As of late, Bicoin has faced something of an arms race.  Bitcoin uses the SHA256 hashing function in its proof of work.  This algorithm is highly parallelizable, which roughly means that throwing more computational power at the algorithm will result in faster iterations.  Graphical Processing Units (GPU’s) are very well suited to the task, and as such they quickly displaced CPU’s as the preferred Bitcoin mining hardware.  More recently, Field Programmable Gate Arrays (FPGAs) and Application Specific Integrated Circuits (ASICs) have taken over the mining scene.  FPGAs are programmable chips and ASICs are specially manufactured chips.  FPGA’s started coming online a year or so ago and displaced GPU’s.  ASICs are starting to appear in mining rigs and will eventually displace FPGA’s.  This arms race has largely left the average person standing on the sidelines, as profitable mining rigs now require fairly significant investments to obtain, and your average desktop computer, even if you use the GPU, is fairly useless as a miner, and in fact would probably result in a negative return on your investment after factoring in energy costs.

Litecoin was created in response to this arms race.  The designers of Litecoin were upset that Bitcoin mining had left the average user in the dust and felt that a cryptocurrency that was designed with a more level playing field would encourage wider adoption.  As such the designers of Litecoin forked the Bitcoin source code and modified the hashing algorithm used in the proof of work.  Instead of using the SHA256 function, they changed the code to use the scrypt hash function.  The reason, in short, for this change was that the scrypt algorithm is more memory intensive, and as such it is not as parallelizable as SHA256.  Therefore, simply adding more raw computational power, in theory, would not have as large of an impact as it would with the SHA256 algorithm.  This means that the gap between the hashing power of CPU’s, GPU’s, FPGA’s and ASIC’s is much narrower, thus giving the average person a better chance at staying in the game.

Considering this, I thought it would be fun to see how my Raspberry Pis would fare as miners for these two different currencies.  In theory, I should be able to mine much more Litecoin than Bitcoin, as the playing field is a little more level, and due to the lower popularity, there are fewer miners resulting in a lower overall network hash rate (its still like bringing a toothpick to a gunfight, but the guns are limited to single shot rifles, rather than semi-automatics, and there are fewer attendees overall!).  Of course, an additional factor that needs to be considered is the market price for each of the coins, as Bitcoin has been trading at over $100 whereas Litecoin has been trading for less than $5.  So while I will most likely mine more Litecoin than Bictoin, it is not yet clear which mining operation will result in the most ‘profit’.

In order to facilitate this experiment, it was necessary to sign up for mining pools for each of the currencies.  Mining pools are a way to aggregate computing resources in order to cooperatively mine the coins.  The major reason for doing this is because for most individuals, it is nearly impossible to successfully complete a proof of work (once again, the mining process is essentially a competition, where the first node to present a valid solution wins).  By joining a mining pool, you ensure that you will receive some form of payout, as the combined resources of the pool should be enough to successfully complete some proof of work, and when it does, the rewards are divided among the pool participants based upon the amount of hashing power they contributed.  For Bitcoin, I chose to use deepbit.net, and for Litecoin I chose to use notroll.in.  I am not endorsing either of these pools as I have not had much experience with either of them (anyone that is seriously considering mining coins should do some research into the pool they use, as there has been numerous reports of shady operators).

So the miners have been running for almost three weeks at this point.  I am going to tally up the numbers and post some results and analysis shortly.

Pi Update and Litecoin Mining

Well, been plugging away a at a variety of projects, but for the most part I don’t have much to show… yet!  I ran through an in-depth Flask turorial (a light weight web framework for python) and am starting to put together a front end for one of the web scrappers I built.  Hopefully I will have that online soon.

In other news, this blog is no longer hosted on the Raspberry Pi.  I moved it over to a hosted solution.  Getting the pi up and running as a web server was a fun little introduction to the device, but ultimately I have a number of other projects I want to try out, and it made more sense to free up the Pi for those projects.  I have ordered two more Pis (for a grand total of four) and hope to play around with mesh networking and parallel computing, however in the mean time, I have set up the two Pis as Litecoin miners (more on that later).

In a few hours, I will be heading out to Costa Rica for a short surf trip, but will write up the Litecoin post while I am on the plane.