Cryptocurrency mining at home (2017 megapost)

UPDATE: 22-Aug-2017 – turns out Genesis Mining is either a scam, or is hacked beyond recovery. They were “hacked” a month ago, and still have not given out payouts to many/most customers.

A little side-project I’ve been working on is: what would it take to do cryptocurrency mining at home? We all know people went crazy with Bitcoin mining. However, as a cryptocurrency picks up steam, the complexity of the “work” gets exponentially higher. Now, it’s to the point where you need specialty hardware, and it’s not that profitable.

However, the principle still stands: if you were to mine for a “something other than Bitcoin” blockchain technology, those can still be profitable. Which ones are profitable? That changes almost hour-by-hour. You can research with sites like https://whattomine.com/ to figure it out. For this blog post, I’m focusing on Ethereum.

Blockchain-based technologies like Bitcoin, Ethereum, and Litecoin are used like currency on the internet. They work by “miners”, doing intense mathematical calculations, and cryptographically verifying the transactions. The miner who figures out the answer, gets a “reward”. How much? Well, it depends on your processing power, and the cryptocurrency. So, what would it take to build one of these miners? Can you just use a regular Windows computer for this? In short, no, not really. You need at least one good-quality video card, first.

tl;dr:

Before you get invested in reading all of this, here are the conclusions up-front, if that’s why you are here:

  • Don’t mine with your hardware: Unless you get free electricity, and even if you do, this is not the best option for mining.
    • You have to find hardware (and GPU’s are SUPER expensive right now)
    • You have to worry about electricity, noise, and cooling. Your rig needs to stay running 24/7.
    • You need a few rigs to make it worth your while. Now you are talking about a lot of heat, noise, and electricity.
    • You have to replace hardware. Any downtime correlates directly to money lost. One of your miners just crashed and you are at work. Now, you just lost 8+ hours of mining time, which is a direct financial loss.
  • Need ability to switch blockchain technologies: You want an option to mine the most-profitable blockchain technology. You can’t easily do that with a custom rig. You could use things like www.minergate.com – but I’m semi-convinced it’s a scam. This supposedly mines the most-profitable thing, but when I manually changed it to Ethereum (where I know my hashrate), and let it run for a couple hours, I consistently only got about 30% of my hashrate. I did this twice, on two days, with the same result. So, either the app is broken, or they are stealing 70% of my hashing power! UPDATE: I’ve been using www.nicehash.com which seems to be legit. It does regular payouts, and it mines the most-profitable cryptocurrency too.
  • Just use contract mining: Instead of spending money on hardware every two years, spend about the same on a 2-year “mining contract”, UPDATE: I would NOT recommend Genesis Mining since they seem to be a scam – or they are hacked beyond repair. It looks like my payouts are being skimmed – or paid right back to Genesis, I don’t know. Find another reputable contract mining company!

Meanwhile, for me, I’m a computer nerd and was curious about the details of how to build out the hardware and software, so I did it anyway. But if you are asking me if you should – if you look at this as a financial investment, then no. Go buy a mining contract. If you just want to learn the technologies involved, and like playing with hardware – then yes!

The Back Story:

Computers have a CPU, and video cards have a GPU (Graphics Processor Unit). GPU’s are a different instruction-set than a CPU, and are intended to do repetitive, mathematically-intensive operations. Normally, that would mean figuring out how to display your video game. However, since cryptocurrencies require cryptographic operations (which are nothing but math), GPU’s are well-suited for mining. How much better are they? Well, my decent 8-core, 4GHz AMD CPU can do 200 operations per second, and one GPU can do 25,000,000 operations per second. It’s a big, big difference.

From that, in the past 6-12 months, mining people having been finding and buying the GPU’s that have the most processing power. Now, video cards are 2, 3, or 4 times what they cost a year ago AND that is if you can find any. Every major retailer is sold out of every good video card.

OK – so let’s see if I can hodge-podge a system together, using some existing parts, and hitting up the used-market (eBay) for video cards…

The Rig:

I had a couple of older AMD-based PC’s which each had issues – so I thought I’d cannibalize from those, and see if I could build something up. These are AMD FX-8350 CPU’s – so I got a compatible motherboard that had four PCI-E slots, which would accept that CPU (an MSI 970 Gaming SLI).

image

I use http://www.pcpartpicker.com to find CPU/mobo/RAM compatibility. Also, I used the RAM and hard drive from the old set up too.

For GPU’s, I would systematically scan the used-market and ended up getting four GTX 1070 cards off eBay. Two are EVGA cards and two are Gigabyte cards.

I’m still waiting for my open-air case to arrive in the mail, so I have everything mocked-up at the moment, similar to a modern art exhibit!

full-rig-pic

You might note that you can’t physically fit four video cards onto any motherboard. For mining, you actually don’t even need a PCI-E 16X connection. Instead, you can buy these risers which accept your 16X video card, and then via a cable, plug in as a 1X card into the motherboard:

image

You need a 16X connection if you are using these for gaming, but not for mining – the 1X connection doesn’t impact your hash rate.

Lastly, for power, I found you can run all of this from one CMX Cougar 1000w – and there are enough plugs available for everything too:

image

So at this point, I have a regular, working system. A new mobo, the old CPU and cooler, the old RAM and hard drive – then those riser cards, and 4 x GTX 1070 video cards. I plug an HDMI cable into the first one, so that I have console video.

The Software:

Most software you can run on Linux or Windows, and some work on macOS. I’m using a Windows 10 setup. That means that this is basically a Windows 10 machine that happens to have 4 video cards plugged into it.

Although my first instinct was to use Linux, using Windows means that you can leave the miner up (on the left) which just scrolls and scrolls all day with statistics, and the ethermine.org statistics page on the right, to see your current hashrate. So, you just RDP into the machine whenever you want to see what’s going on:

image

I have this computer automatically log in, and automatically launch these two things too. So even after a reboot, it will go back to this state.

With Linux, you’d had to use “screen”, and then attach to the current screen session once you SSH’ed in. So, I would argue that Windows might be a better fit for your miner – and as you’ll see below, it will still run perfectly fine on modest hardware.

In my case, I’m mining Ethereum. You can mine directly to the blockchain (but have to waste CPU to stay current with the blockchain), or you can mine to a mining pool. However, a mining pool could be a scam. In fact there could scams at almost every level of this. So, you should be somewhat paranoid, throughout!

Mining to the Blockchain (your pool):

If you want to mine directly to the blockchain, you need a machine to constantly keep synced with the blockchain. That can eat up ~50% CPU and for Ethereum, uses ~30GB of disk space. You can do this by using “geth”, like this:

$ geth –etherbase ‘0x0000000000000000000000000000000000000000’ –fast –rpc –rpcaddr 0.0.0.0 –rpcport 8545 –rpccorsdomain * –rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3 –datadir “/ethereum”

Where the 0x000…000 is your Ethereum address where you want to receive mining proceeds and where /ethereum/ is the directory where you want to store the “database” for the blockchain. I ran this on a Linux VM – but you could use Windows if you have an extra Windows license to burn

To connect to this proxy, or “pool” from multiple miners, the miners just run:

$ ethminer -G -F http://192.168.1.32:8545

Assuming 192.168.1.32 was the VM running the command above, and port 8545 is the default port. In other words, this main machine constantly syncs with the blockchain on the internet, and accepts connections from miners on port 8545. Those mining machines do their work and connect to the main machine to submit their work and get new jobs.

I found this to be pretty problematic. On Linux I use “supervisor” to start and restart the pool, but still – I got all kinds of errors, and worse, it would start a “new” database on a partition where I didn’t have enough space. It was just a mess. Running it interactively – it would be fine, but then would crash. I would SSH back in, and it would start rebuilding the database from scratch (which takes 3-6 hours).

Instead, you can just mine to an internet-based pool – with some caveats.

Mining to a Pool:

There are two supposed advantages to using a public pool. 1) you don’t have to have a machine to sync to the blockchain (as described above) and 2) you could potentially get other rewards from the pool. The downsides are:

  • The pool takes 1%+ of your proceeds
  • Every single part of this could be fraudulent!
  • The pool can lie and skim your hashing power
  • The pool could not give you your payout

But worst of all is this one gotcha common to most pools: most pools only payout in 1 Ether increments. That means that if you’ve mined 1.999 ETH and decide to stop mining, they keep the .999 Ether. So, you have to revolve your mining around when you hit EXACT increments of 1 Ether.

That may not seem significant, but think of it this way: if you have 4 x 25MH/s video cards – and have ~100MH/s of hashing power, you will only hit 1 Ether about every 3.5 WEEKS. So again, if you stop mining, you give away quite a bit of hashing power that is rightfully yours. And this is common to pretty much all public pools that I researched.

How do find a legitimate mining pool? I just did a lot of searching to see what the masses say. It seems that www.ethermine.org is legit, and I’ve been using them. You can also just search: https://duckduckgo.com/?q=ethereum+mining+pools

Which Software:

For direct mining or running a pool server, you can use geth, from here: https://github.com/ethereum/go-ethereum and for connecting to pools, Claymore seems to be the standard, here: https://github.com/nanopool/Claymore-Dual-Miner

And just to give you an idea, for claymore, I run a command like this:

$ EthDcrMiner64.exe -allpools 1 -epool us1.ethermine.org:4444 -ewal 0x0000000000000000000000000000000000000000.Rig1 -epsw x -mode 0 -tt 80 -dpool stratum+tcp://stratum.decredpool.org:3343 -dwal myminer.user -dpsw mypassword

That is, where the 0x00..000 is the Ethereum address that should receive the mining proceeds, and I’m doing Decred mining to http://www.decredpool.org

UPDATE: Again, a great alternative too is just to use www.nicehash.com – as that seems to be legitimate, and it works on the most-profitable currency at the moment.

The Case / Heat / Power:

The GPU’s run at 100% usage all the time. Therefore, they are going to kick off some heat. In the case of these EVGA GTX 1070’s, each one feels like a hair dryer, on low. The Gigabyte GTX 1070’s on the other hand, run 20 degrees cooler, are quiet, and are not hot to the touch. Regardless though, you can’t fit 4, 6, or 8 GPU’s in a regular computer case. You’ll need an “open air” case (aka mining rig case).

Image result for mining rig

Luckily, the internet has responded and you can buy these sorts of things on Amazon and eBay. Although, you can tell these are just $10 in parts – and everyone sells them for $100-200 each. Maybe THAT’S where you can make some good money!

These all seem to be about the same: the mobo and power supply go on the bottom level, and the GPU’s can be mounted on an upper shelf.

With power – I got this CMX Cougar 1000w, which handles the load fine, stays quiet, and doesn’t kick off much heat:

image

Each video card required a 6 or 8-pin power connector. This power supply has 8 of those types of connects on the back. Also, so you have an example, this AMD FX-8350 system with 4 x GTX 1070’s (while running) use about 740 watts and hovers around 150-200 watts while idle.

Recommended Hardware:

So what should you get or what kind of computer could you re-purpose? Well, I was a little surprised to find that mining uses very little CPU or memory. See below, this is while actively mining, with 4 GPU’s running at 100%. The rest of the computer is basically idle:

image

And for disk, I have about 20GB of log files (in: C:\Users\miner\AppData\Local\Ethash\) – your copy of what was mined, if you wanted to compare to what the pool claims you mined. Aside from that, this doesn’t require much disk space either.

They key thing is really how many PCI-E slots there are on the motherboard. Remember, those risers just need a 1X slot – so you can use 4X, 8X, or 16X – but the important part is total number of PCI-E slots. That will determine the total number of GPU’s you can support. Aside from that, literally ANY CPU and about 4GB of RAM should be good. I have an old 120GB SSD for a hard disk.

What GPU’s to buy?

First, you need to know how much processing power each GPU has. For that, I start with a search query like this: https://duckduckgo.com/?q=ethereum+hardware+comparison and start looking at a bunch of different pages. When I see some consensus, I write down those numbers.

image

A smart way to do this would be to get all the makes/models, then get their hashrate – then scour the internet for prices. From there, you could extrapolate which video cards have the most hashing power, for the least amount of money. Get how much power they use, too – since that’s part of the equation.

For example, GTX 1070’s can give you about 25MH/s – but they are $400+ right now. Sapphire R9 280X’s only give you about 22MH/s, but you can find them for $150. So, you have to make those sort of decisions. Also, consider there is a MH/j or megahashes per joule of energy.

So basically – do research and buy the most hashing power, from a card that uses the least amount of power, which costs the least amount of money. What that card is – will change from day to day.

Income Overview:

OK, time to talk about the sweet, sweet dollah-bills, y’all!! Well, prepare to be underwhelmed. There can be many different types of configurations, and you can mine different currencies. However, let me isolate one possible scenario – the setup I built out:

  • AMD FX / Windows 10
  • 4 x GTX 1070’s
  • Mining for Ethereum (ETH)
  • $.10KWh net rate from my electric company (monthly bill divided by the KWh usage)

Let’s look at expense versus income for 1 month. First, you might have $2,000-2500 invested in hardware. Next, let’s say the whole system uses ~740 watts while running. Go figure out your kilowatt hours with a formula like this (assuming $.10 KWh net power cost from your electric company):

740 watts x 24 hours = 17,760, or 17.7KWh
17.7KWh x $.10 = $1.77/day = $53.10 per month for electricity

On the income side, go search for: https://duckduckgo.com/?q=ethereum+mining+calculator since those numbers change all the time (ETH price, network hashrate, etc). For example, use: https://etherscan.io/ether-mining-calculator

Putting all of that together into a little Excel sheet to look at income/expense for 2 years with on-prem hardware, I get:

image

So basically, if you were to build out a 4 GPU rig mining Ethereum (which is crashing, at the time of this writing), that one rig would earn you $1,435/year of profit, and it would take 1.6 years to payoff the initial hardware expense. At the end of two years, you’ll have made $621.19 net and paid off your hardware (assuming ETH prices remained the same).

There are several key things you could tweak here:

  • Spend less on GPU’s (again, R9 280X’s would give you almost as much hash power, and would cost you about 1/3.)
  • Get better quality hardware that uses less power.
  • Get free/cheaper electricity (solar panel, wind turbine, etc for your property)
  • You can mine different currencies although as of this writing, Ethereum is still the 2nd most profitable one: https://whattomine.com/

Bottom Line:

You can’t just casually mine. Even with the above setup – which is kind of extravagant with FOUR GPU’s, a custom open-air case, and hours of setup – only yields about $120/month of profit and it’s going to take you a year and half to pay down that hardware investment.

Sure, it’s extra money, but is it worth it? What I’m saying is, with ALL of that effort, that only results in $120/month, imagine what you would make with one GPU in a “gaming” computer, with the card constantly overheating?

It’s not even worth your time until you have at least 4, 6, or 8 GPU’s, and ideally a few of these rigs. But then consider the heat, noise, and electric bill!

At that point, you’d be using as much electricity as an illegal grow operation, and you can probably expect a no-knock SWAT raid at 4am where the police will shoot your dog!

Then, there is the financial side of it. If you are doing this as a financial investment, you are talking about 1.6 years to pay down your hardware costs. So, at the end of 2 years, you made 5 months of profit (~$600 total, for 2 years of effort). Compare that to Genesis Mining (who you should NOT use!):

image

Even right now when Ethereum prices are cratered super-low, it’s still a better deal. If you buy a 100MH/s contract, then your ROI is 1.3 years

image

So yes, the initial cost is slightly more than buying your own hardware – but you have ZERO electricity costs. This nets you over TWICE as much net profit over the course of those two years. This is why I’m a believer in contract mining. UPDATE: Since Genesis Mining is either a fraud, or is hacked – it’s not a matter of finding another legitimate contract mining organization! 

If you are doing this just for the fun of it though – I say go for it! This is all the best parts of: building a PC, tweaking settings, monitoring performance – and it’s all directly tied to potential profit. So, on your own hardware, it can still be profitable – in addition to being fun to play with!

Posted in Blockchain, Computers and Internet, General, Infrastructure, New Technology

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

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3 other followers

%d bloggers like this: