A Few Lessons Learned While Mining Crypto

Jason Robinson
Good Audience
Published in
17 min readJun 9, 2018

--

Photo by Rafael Pol on Unsplash

Disclaimer: Any links and/or information found in this article are provided for informational purposes only. There is no implicit or explicit guarantee of their safety.

For example, MyEtherWallet currently recommends “Install EAL or MetaMask or Cryptonite by Metacert or the MyEtherWallet Chrome Extension to block malicious websites.” So, think before you click.

Furthermore, this is not a recommendation or advice to mine, refrain from mining, invest in, trade, avoid like the plague, or do anything related to cryptocurrencies, or anything else at all, for that matter.

Additionally, this article is not a criticism of cryptocurrencies or the mining thereof. It’s an account of my experiences, which may/may not be helpful to others. The goal is to be balanced and informative.

Several friends and acquaintances have asked about my experiences mining cryptocurrency (also referred to in this article as mining crypto). So, we’ll explore this topic in some detail.

This post contains stories, lessons, and explanations — we’ll explore mining at a high level, as well as at a technical level. This is not a how-to article, and it’s not full of code, but it points out a lot of useful tidbits for those who may just be getting started with mining. Those tidbits can be hard to find, and they can make the difference between frustration and progress.

The technical parts are a little slanted toward Linux, based on my own preferences, but I have also included Windows and Mac details, where appropriate. So, let’s dive right in and start with the basics.

Why Mine Crypto?

Photo by Matt Lamers on Unsplash

At a high level, people mine crypto for different reasons. Some are altruistic — these people believe in particular currencies and want to enhance liquidity and facilitate transactions, because they want those particular currencies to be broadly accepted and useful. Those are noble goals. The financial reward doesn’t hurt, but that’s not their overarching purpose.

Some mine purely for financial reward. The idea of setting up a computer, pressing go, and watching your account fill can be enticing. And your account could even be filling as you sit on a beach sipping Mai Tais and counting seagulls. Interested yet?

Some mine cryptocurrencies to learn more about the whole process, essentially just to be involved. Cryptocurrencies are still relatively new and hot, at least when compared to most currencies on the market. Many in the cryptocurrency world refer to any currencies that have been historically traded via paper notes as “legacy currencies.” But time will tell, for each currency.

Some mine because all of their friends are mining, or because they already happen to have the right hardware. For example, if you were a gamer in the past few years and had invested in a reasonably good graphics card, then you could game for part of the day and mine the rest of it.

And some mine unwittingly — for example, some of you, my dear readers, may be mining crypto right now without even realizing it, via cryptojacking. In short, people may surreptitiously use your computing resources to mine crypto on their behalf, right under your nose! Don’t expect to get a cut of the profit, though. You’re really just there to pay the computing bill.

Why Did I Decide To Mine Crypto?

For me, it was a combination of the reasons that I mentioned. I wanted to learn more about mining, to see just how easy or hard it was.

Also, I have a technical background, so I felt like I was just being lazy by not trying to mine some crypto.

And like many, I had planned to get involved in crypto for a while (since around 2012, but who’s counting?). I just hadn’t done it (in six years…).

But FOMO, or the Fear of Missing Out, rears its head when you least expect it. Will I completely miss out on the crypto boom? Has my MBA in Finance prevented me from cashing in on the modern day gold rush??? And so on.

Fully embracing FOMO and deciding to take action so that I would not miss out, I answered the buy or build question for myself, so to speak.

I enjoy a technical challenge, so I decided to mine instead of buying crypto. In fairness, there are some technical challenges that people may face when buying crypto, but that’s not our primary focus today. And as you already know, I have a finance bent, so I’m highly unlikely to roll the dice, buy some crypto, and HODL. That’s just not in my nature.

Finally, I’m not aware of any significant cryptojacking — which I guess is the point — I took a lot of necessary precautions around wallets (for further information, you can learn about Bitcoin, Monero and Ethereum wallets, but this is a hot and evolving topic), browsing (as mentioned above, MyEtherWallet currently recommends “Install EAL or MetaMask or Cryptonite by Metacert or the MyEtherWallet Chrome Extension to block malicious websites.”), and so on.

I was careful when typing URLs, and I didn’t click on any sponsored posts around crypto. Those are good ways to get jacked (they might have gotten me on ads for cargo shorts, like the fabulous and exquisite pair that I’m sporting as I type this article, but not on ads for cryptocurrencies or related sites).

Moreover, I didn’t click on links in chats or messages on Telegram, which happens to be a really nice chat app. As an aside, you can find a ton of channels devoted to crypto on Telegram, or even meta-channels, which list relevant channels. Of course, there are many informative SubReddits, like the GPU Mining SubReddit, as well as Discord channels. But I digress. You’ve got a search engine or two at your disposal, and you know how to get to Reddit.

I even set up a pair of dedicated workstations for mining, sitting behind a VPN, as we’ll discuss below.

However, there was one unwitting, or at least naive, aspect to my mining efforts (sadly, repeated), and we’ll discuss that as well.

Getting Started

Photo by Trust "Tru" Katsande on Unsplash

Online resources provide a wealth of information on mining, crypto, and everything else. I’ll link some of those below, but you can easily find these with your favorite search engine or Reddit, since this is not a how-to article.

But at a higher level, there are a few key questions that you have to answer before you start:

  • What computing resources do you have?
  • Which coin(s) do you plan to mine?
  • How expensive is electricity?
  • Just how committed are you?

Let’s consider each of those questions.

What Computing Resources Do You Have?

This section will be reasonably high level, but we’ll dip into some of the technical aspects as well. If those don’t make sense, just focus on the more introductory parts of each section and move on. You can learn a lot that way, and you can certainly come back as your knowledge grows.

It’s possible to mine crypto with various and sundry computer hardware. Let’s take a tour though the wonderful world of hardware.

Some cryptocurrencies, like Electroneum, can even be mined on your phone.

But CPU, GPU, and ASIC mining are more common.

CPU Mining

Photo by Roman Spiridonov on Unsplash

It’s pretty hard to have a computer without a CPU (central processing unit, probably with multiple computing cores and often with Hyper-Threading Technology (HTT), which essentially doubles each CPU core’s computing resources), so the average consumer often has this resource.

One key detail about mining crypto is that your computer is basically solving cryptographic math problems. It turns out that some CPUs do this better than others do.

For example, I dedicated two HP Z800 workstations to mining. I had acquired one from a friend and purchased the other one from eBay. They are not the latest hardware on the market, but they are well-built and reasonably respectable workstations, still highly capable for solving a variety of problems.

Over the past few decades, I have built, fixed, and upgraded more computers that I can count, and I worked at Intel in technology development, so I’m pretty familiar with computer parts and upgrades.

So, over time, I had upgraded these workstations with a lot of RAM (not necessary for mining crypto, but I use these computers for data science and machine learning), a new power supply (more of a fix than an upgrade), new hard drives, video cards (from a friend, eBay, and Fry’s), and CPUs.

Let’s explore some of the details — they may seem mundane, but they really matter when you decide to mine crypto.

Initially, the Z800 from my friend had a single quadcore Xeon W5580. Since I had been doing machine learning and other work, I had already ordered another fan and CPU from eBay, as well as a lot of RAM. Fans are expensive on these units, but it was now a dual quadcore Xeon with a boatload of RAM.

Anyway, I had compiled xmrig from source code on Ubuntu 16.04 (there are many other very good mining options, but I chose xmrig, specifically to mine Monero on Linux; the main developer is very responsive on Github, as well). I was using the updated algorithms for the Monero proof-of-work (PoW) change this past April sixth (which shows up clearly in the overall hashrate chart), so everything was reasonably well configured.

As an aside, I’ll mention that Windows, by virtue of being a go-to gaming platform for many, has a strong set of Windows-specific mining options. With Mac, not so much, since hardcore gaming is not really why most people buy a Mac. But it does have GarageBand, which is nice. Anyway…

I use Linux, Mac, and Windows to some extent, and I don’t judge you if you prefer one or the other, but I prefer Linux for anything involving a command line.

The second Z800, the one from eBay, has dual hexcore Xeon X5650s, also with a lot of RAM, which is unnecessary for mining crypto — it’s compute intensive, so the CPU/GPU specifications matter more than memory size, which can be modest.

Indeed, if you watch your computer resource monitor while mining, you should see that memory is barely touched (unless you’re using a netbook or something like that), network usage is light, and your CPUs are screaming.

Mining performance is measured in hashrate. Basically, in this context, it’s a measure of how rapidly your hardware is completing cryptographic calculations. Higher numbers are better, all else equal. For example, as you run xmrig, you’ll see the relevant hashrate information displayed on your terminal.

So, I had set everything up for mining across the two machines that I mentioned.

And here was the problem: the slightly newer but slower-clocked X5650s were blowing the doors off of the faster-clocked W5580s, by a factor of several times. That was really unexpected. (I’m resisting the temptation to focus on numbers, but if you need that, here’s a pretty thorough comparison for some newer Xeons.)

Sure, the X5650s are hexcore and the W5580s are quadcore. But at 2.66 GHz versus 3.20 GHz, something seemed off. The difference in hashrate was too large to ignore, and I had to dig into it.

So, I whipped out Google, and after some deep and profound googling, I realized that I had not set hugepages. This was a useful find, and here’s more technical details for Linux and Windows users. Setting hugepages improved the hashrate substantially on both machines (10–20%, as I recall), but it did not resolve the problem. For xmrig, you’ll know if hugepages are available and enabled if the logging shows available, enabled.

After even deeper and substantially more profound googling, I isolated the problem. If you go back and read the spec sheets for the Xeon X5650 and the Xeon W5580, you’ll find a key detail.

Way down, under “Security & Reliability,” you’ll find an entry for “Intel® AES New Instructions.” This entry specifies no for the W5580 and yes for the X5650.

It turns out that if you’re looking for a Xeon CPU and want higher performance while you’re mining, then you need a CPU with AES-NI (Advanced Encryption Standard — New Instructions).

You can get an idea of the difference in performance for cryptographic from GeekBench 3 (AES single core) benchmarks on CPUBoss. It’s staggering how much of a difference AES-NI makes.

So, I did what any reasonable and sane person would do. I confirmed that the boot block date in the BIOS in this Z800 could handle the X56xx series processors, then headed on over to eBay and ordered a pair of hexcore Xeon X5690s.

To be fair, for the price difference, there wasn’t much of a benefit versus the X5650s, based on AES alone. And the hashrate difference that I saw was on the order of 10% better for the X5690s. But, since I was upgrading and would use this machine for other things, I went for the “extra cheese on the Whopper” option. And I was irritated by the prospect of going from a fast quadcore that I had already invested in doubling to something slower, even a hexcore. And, depending on the processor that I chose, it would have been a waste of the high performance fans that I already had.

One more aside for the hobbyist is that I never got both CPUs to work simultaneously without a performance hit. One of the two CPUs would run at full bore (6 cores on one processor running at 100% as 12 cores, due to HTT, mentioned above). I didn’t dig deeper into this, because I was focusing on getting the GPU mining going, as we’ll discuss in the next subsection.

GPU Mining

“A computer without the case showing the motherboard, cooling fans, graphics cards, and power supply mounted on a red-lit wall labeled ASUS in a gaming convention” by Maxime Rossignol on Unsplash

Many consumers also have at least one discrete GPU in their computers. Discrete means that it sits alone, as a part of your computer, which is typical of higher performance GPUs. You can take it out and put another one in.

The other major type of graphics capability, typically found in lower-performance machines, is integrated graphics. Integrated graphics use system resources to display graphics. For example, they may use compute and memory resources to display graphics for you.

Integrated graphics are really not even remotely as good as discrete graphics for mining (or really as good for anything related to graphics) as a discrete GPU, even a low-end one.

It’s kind of like using a really small wrench to drive a nail. It might get the job done, for a small enough nail. And people do it (I mean mining with integrated graphics… not sure about the tiny nails). But there are better ways to mine crypto.

As alluded to above, GPU mining is generally easier and more productive with Windows and Linux, because those platforms are better for gaming and high-end computations, generally speaking. You can install some really high-end graphics cards from AMD or NVIDIA in a PC. If you have a Mac, then it’s reasonable to expect lower mining performance for the same price point. Nothing against Macs — I’ve used and enjoyed Apple computers since around 1980 — but let’s be realistic.

You can also use multiple cards — as many as your motherboard will support. You can get a motherboard that supports 19 GPUs, currently for around $85. The GPUs cost a bit more, though, and you need to figure out how to mount and power them.

For example, I had two NVIDIA Quadro 5000s in one workstation, and an NVIDIA GeForce GTX 960 and Quadro K600 in the other workstation. It’s OK to mix and match video cards in a Linux system, as long as the drivers are compatible. There are higher-performance configurations that you can use when they match, though.

People also use overclocking to squeeze more performance out of hardware. For example, with NVIDIA GPUs, some people enable coolbits and go from there. I had no problem enabling coolbits, but for the GTX 960, I had a similar issue to the one described here.

So, I ended up not overclocking the cards. That’s probably for the best, since overclocking the cards puts a bit of strain on them, and you have make sure the fans are keeping up.

At a high level, similarly to the setup described in the CPU section above, I ended up installing CUDA and compiling xmrig-nvidia for mining on Ubuntu. There are Windows and Ubuntu build instructions, which are pretty simple. Of course, there is also xmrig-amd for those with AMD cards.

If you run into errors, the key is to make sure that you aren’t having compatibility issues and that everything actually installed correctly. If in doubt, it’s best to use the versions recommended exactly. There are also some good tips in this link.

Basically, a key point in that link is that depending on what OS you’re using, make sure that bfactor and bsleep are set correctly. Otherwise, you may have trouble using your computer, if you’re using the GPU resources at full throttle.

Anyway, if you want to find out how your hardware might fare while mining Monero, there is a good searchable Monero Benchmark site. On the GPU side, it has everything from tiny cards to high-end 12-card rigs. There are also some good Monero benchmarks at XMR-Stak.

ASIC Mining

“Close-up of a black Persian cat” by Stefan Ivanov on Unsplash

ASIC stands for application-specific integrated circuit. In other words, the chip is specific to the application that it’s working on. So, ASIC chips may be targeted toward mining a particular cryptocurrency, such as explained here for Bitcoin.

Why target mining a particular coin? Because these chips can do it really well, so it can be quite profitable. So, if you buy a Bitcoin mining rig based on ASICs, then you can expect superior performance for the same financial outlay. But you won’t be surfing the web on it.

And, one thing to keep in mind is that if the price of the coin tanks, then you might end up with a worthless miner.

Some coins are advertised as being ASIC resistant. That was one of the reasons that I was interested in mining Monero, since CPUs and GPUs would theoretically have a chance to mine profitably against ASICs.

Sia published a fabulous article last month, The State of Cryptocurrency Mining, which states

The vast majority of ASIC-resistant algorithms were designed by software engineers making assumptions about the limitations of custom hardware. These assumptions tend to be incorrect.

, and further

It’s estimated that Monero’s secret ASICs made up more than 50% of the hashrate for almost a full year before discovery, and during that time, nobody noticed. During that time, a huge fraction of the Monero issuance was centralizing into the hands of a small group, and a 51% attack could have been executed at any time.

Oh, great.

I won’t ruin the punchline in that blog post, since it’s well worth the read.

Anyway, whether you compete with ASIC miners, or buy your own, it’s worth considering how they impact your mining efforts.

Which Coin(s) Do You Plan To Mine?

Photo by Chris Liverani on Unsplash

If it feels like there are a lot of options for mining, and that you have to consider how your hardware, OS, and software might fare in the mining arena, then you’re feeling right.

Cryptocurrencies vary in price all the time, so it’s important to consider any particular coin’s price, your computing capabilities, local and broader market dynamics, adoption, and long-term staying power, among other things. Does this sound complicated? It certainly can be, especially if you’re considering a coin near an ICO.

In fact, there is at least one website devoted to this question: What To Mine.

Some of the things that I considered when choosing a coin to mine were that I liked Monero’s stated ASIC resistance, as well as the privacy-related technology behind the coin itself.

But there’s more to consider.

And, here’s where we (finally) come to the unwitting part that I mentioned.

So, do you mine for yourself, or do you mine in a mining pool? As you might expect, mining pools essentially pool the resources of multiple miners, which increases the group’s chances of finding block rewards and getting a payout.

When you consider this question, it’s worth paying attention to pool fees and payout thresholds. It turns out that you have the opportunity to pay a lot of people, as a miner. Even software for mining may include a mandatory cut of your mining profits. Not that this is wrong, since it’s nontrivial for the average consumer to write their own mining software.

I’m not going to say which pools I participated in, since that’s unnecessary finger pointing. You can and should find payout thresholds if you search.

I started with one pool, but finding out how close I was to payout was an opaque process. OK, so I mined for the pool, but never got a payout. In essence, I think I cryptojacked myself.

So, I spent some time on Reddit and found another recommended pool. It was fine, and finding out exactly how close to a payout you were was simple, but running the two machines that I mentioned day and night was going to take around 2 months to produce half a coin, which was the required threshold for payout. After about a month, I was at 41–42% of the threshold. But, as I mention below, I pulled the plug on that.

How Expensive Is Electricity?

“Electrical towers and grids of power lines against a sky at sunset” by Fré Sonneveld on Unsplash

I know that computers consume electricity, and you do too. But it’s hard to really know how much you’re using at the time, and depending on how much mining you’re doing, things can get hot. Hot. Really hot. Which means that power is going somewhere.

Not everyone in the house was excited about how hot one particular room was becoming, so I moved one of the servers into a different room, and it still wasn’t enough. I literally did not need to turn on the heat in the evening, because the servers were doing such a good job of heating our place.

For example, some people in Siberia may use mining equipment to heat their homes. That video mentions a nine-month heating season, so using mining rigs as heaters arguably makes sense.

But I received my utilities bill, and my year-on-year electricity use for the month had tripled, due to mining plus cooling costs. That was insane. And summer would be coming up in a few months, so how much did I want to spend to cool the place even more frequently?

I’m a bit of an environmentalist, and I couldn’t justify continuing down the mining path.

So, I pulled the plug on the machines.

Just How Committed Are You?

Photo by Zachary Nelson on Unsplash

If you’ve made it this far in the article, then you may be excited to start the process. What’s your current commitment level?

Are you ready to

  • get the right hardware, if you don’t have it already
  • set up the right software
  • figure out what to mine, profitably (net of equipment, electricity, and opportunity costs)
  • deal with being hot
  • spend more on electricity
  • keep up with the ecosystem, the coins themselves, and the market in general, so that you know that you’re still mining correctly and profitably

It’s worth doing some research and deciding on your budget ahead of time, since costs can really add up.

Keep in mind that it can really get hot as you mine. Hot. Super, super hot. So consider those cargo shorts that I mentioned earlier. You don’t want to wait until the last minute…

If you’re not ready, and you want to learn more about crypto in general, in addition to what you’ll find on Medium and in web searches, there are a lot of resources at Udemy (not free, so dig into these yourself if you like), as well as some great podcasts, like Crypto 101. Tim Ferriss also has a really nice interview with Nick Szabo. And that’s just the tip of the iceberg.

So, What’s The Result?

“A pug wrapped in a blanket on a bed” by Matthew Henry on Unsplash

Well, I learned a lot. But I never reached a payout threshold. So, I spent a lot of cash, upgraded my computers, and ran some interesting processes, as well as improving liquidity for the Monero community, but I’m not buying a Ferrari tomorrow with my (nonexistent) earnings.

Realistically, in terms of mining profitably, I was late to the party in 2018.

Author

Connect with Jason on Medium, LinkedIn, Quora, AngelList, Facebook, and Twitter.

Connect with the Raven team on Telegram

--

--