Friday, April 6th 2018
Confessions of a Crypto Miner: Green(er) Mining
Welcome back to "Confessions of a Crypto Miner," my column about a crypto miner from 2013 trying to get caught up with the latest standards. I'm presently mining and reporting to you from a dual-GTX 1080 based rig mining zCash. Today, I'm going to talk about saving energy and reducing a miner's impact on the environment. How can you do that, you ask? Simple: Consolidation.
Mining inherently consumes a lot of energy, but a lot of things we do as tech geeks are actually not all that efficient. Case in point, my NAS I've had for years. Old Lenovo server-something or another, modded pretty hardcore, but still energy-drinking to the core. It's based around a Core 2 Quad and uses around 400W of power on its own when not doing much of anything more than being an NAS. It features big RAID arrays and big blower fans, none of which I really need in this day and age and all of which consume power. I've been thinking since I got my Ryzen quad core mining rig: What's to stop me from mining and doing my NAS stuff on the same rig, thus saving power? As it so happens, not much. My miner has the same memory size as the old Lenovo DDR2 solution and a far more energy efficient, likely faster CPU. So I can fold that 400 W server into my 550 W of mining, far reducing my footprint in a green sense. Let's get to it.
There are some caveats of course (aren't there always?) I don't have enough CALs to use Windows Server (my license is an old Academic one), so we'll be going Linux. In this case, Gentoo, since it's what I'm familiar with and I like its performance when you get it going.
Gentoo is a source-based distribution, so if you want to follow along, I suggest a strong understanding of Linux-based systems. Most of what you need can be found in the Gentoo Handbook at Gentoo.org. I will glance over a lot of the low-level stuff and just briefly describe my process for posterity.
I started off with a basic system AMD64 install with Ryzen optimizations to the make.conf, and then I proceeded to follow the respective guides for X11, the NVIDIA binary driver, and XFCE. For XFCE, I set it up with very little installed and minimalist to the core. I set up a browser (Firefox), a process manager for killing processes in the GUI (mate-system-manager), and a GUI package manager for Gentoo's portage package management system called "porthole" (clever, eh?). I also installed a binary remote desktop management system (RealVNC), for which I already have a license. Its advantage is that is supports native encrypted connections, but you can find other open source solutions if you dig around; they just require more setup. I also installed Samba for the NAS functions. Samba is the Linux equipvalent of Windows File Sharing and is compatible with the latter. Configuring Samba's smb.conf is beyond the scope of this article, but it's really not hard, especially if you are just doing a "family folder" style setup like me.
Once all that is done, I have a desktop that looks roughly like this:The next thing to do, is get our miners and wallets functioning again. Storing your coins on the machine that mines them is not exactly the best security practice, but it does save energy vs firing up another machine, and the risk can be mitigated by periodic cash-out or transfer to cold storage (paper for me). Again, in this case I am choosing the energy saving option, and I am powering down a small highly firewalled system that in the past ran wallet software 24/7. Between all this, the miner at 550W is now running virtually for free if you count all the energy reductions, so why don't we CPU mine while we are at it? We will not just load our typical mining setup of EWBF's CUDA-based Zcash miner, but also xmr-stak, a highly capable Monero miner for the CPU. It will use half our CPU, or 2 cores, leaving enough power for the wallets and NAS to function. In an earlier column I talked about Monero not being worth it, but I feel it might be worth giving it another try, to see what comes out of it.
First, let's start with the wallets. We grab our wallet files and install the official Zcash client from source using the guide at the Zcash site. It's a simple CLI client, so I also load a Java-based SwingUI GUI from GitHub to pipe the commands and make management easier (note, the client is marked deprecated, but works fine). All this is compiled relatively easily in Gentoo, which is pretty much a complete development environment having gotten this far. The only thing I needed to emerge (install) to complete this is oracle-jdk-bin, which is the package for the Java 8 SDK needed to compile the SwingUI based GUI.
The GUI, when finished, imports the wallet fine and looks like this (probably time for a weekly cash-out, speaking of which!):Next, I install Electron Cash, a Bitcoin Cash light client wallet (I seldom hold Zcash, and this is where most of my coin is now for lower fees and higher liquidity at cash-out). It installs relatively easily as well, as it's based on Python and its dependency list is easily installable via porthole, the GUI package manager we already met earlier.
Note that there is an ebuild (Gentoo Package) for Electron Cash. Don't use it. It's woefully out of date and has dangerous security loopholes. Why it isn't blocked on the Gentoo repository is beyond me.
Now, with those set up, we can download the binary EWBF's CUDA miner, which installs easily because it is binary, and then xmr-stak, whose build guide is easy to follow and also installs easily and with few dependencies besides openssl and obvious things. We have them installed now and point them to our pools. They are waiting to fire up, but I have one more thing I want: Wine, which is a Windows emulator for Linux.
Why do I want Wine? Because I have a funky old UPS that carries my miner through short circuits that plague our location. It doesn't run long, but it allows it to shut down properly, and it stops short circuits from resetting everything. It's an Opti-UPS GS1100B, which is a known Windows-only non-HID compliant piece of crap that requires some Windows software to function. The Windows software communicates over a virtual COM port on USB, which surprisingly, the latest Wine supports. We emerge (install) it, and check .wine/dosdevices to make sure the mappings are right. We find our USB UPS COM port present on COM5 as a symbolic link to /dev/ttyUSB0Feeding that to the software gets us some figures:It passes a self-test, as evidenced in this screenshot; communication is thus working (note the load meter does not work during a self-test. It is normally at about 80%):
Now, finally, it's time to kick things online. I write some startup scripts, assign them to startup via settings-manager - Session and Startup in Xfce, and reboot. I am greeted by the following:We're mining happily, and the file server works fine. I'm even hosting a DLNA server on the side. I guess what I want you to take away from this as a miner is, your miner can do more than mining cryptocurrency. Consolidate. Just because we're miners doesn't mean we can't "think green." That's silly. Turn some things off and reduce your power and carbon footprint to compensate for the big one you'll be making while mining. Then, the next time someone calls you "mining scum" and accuses you of polluting the planet more than the average geek, you can happily prove them wrong. And why not? At least for a small-time miner, it isn't hard to do, it's fun, and that's part of why we IT types do everything we do, is it not? This guide isn't the only way, but there certainly are ways to accomplish what I'm saying. Get to it!
Mining inherently consumes a lot of energy, but a lot of things we do as tech geeks are actually not all that efficient. Case in point, my NAS I've had for years. Old Lenovo server-something or another, modded pretty hardcore, but still energy-drinking to the core. It's based around a Core 2 Quad and uses around 400W of power on its own when not doing much of anything more than being an NAS. It features big RAID arrays and big blower fans, none of which I really need in this day and age and all of which consume power. I've been thinking since I got my Ryzen quad core mining rig: What's to stop me from mining and doing my NAS stuff on the same rig, thus saving power? As it so happens, not much. My miner has the same memory size as the old Lenovo DDR2 solution and a far more energy efficient, likely faster CPU. So I can fold that 400 W server into my 550 W of mining, far reducing my footprint in a green sense. Let's get to it.
There are some caveats of course (aren't there always?) I don't have enough CALs to use Windows Server (my license is an old Academic one), so we'll be going Linux. In this case, Gentoo, since it's what I'm familiar with and I like its performance when you get it going.
Gentoo is a source-based distribution, so if you want to follow along, I suggest a strong understanding of Linux-based systems. Most of what you need can be found in the Gentoo Handbook at Gentoo.org. I will glance over a lot of the low-level stuff and just briefly describe my process for posterity.
I started off with a basic system AMD64 install with Ryzen optimizations to the make.conf, and then I proceeded to follow the respective guides for X11, the NVIDIA binary driver, and XFCE. For XFCE, I set it up with very little installed and minimalist to the core. I set up a browser (Firefox), a process manager for killing processes in the GUI (mate-system-manager), and a GUI package manager for Gentoo's portage package management system called "porthole" (clever, eh?). I also installed a binary remote desktop management system (RealVNC), for which I already have a license. Its advantage is that is supports native encrypted connections, but you can find other open source solutions if you dig around; they just require more setup. I also installed Samba for the NAS functions. Samba is the Linux equipvalent of Windows File Sharing and is compatible with the latter. Configuring Samba's smb.conf is beyond the scope of this article, but it's really not hard, especially if you are just doing a "family folder" style setup like me.
Once all that is done, I have a desktop that looks roughly like this:The next thing to do, is get our miners and wallets functioning again. Storing your coins on the machine that mines them is not exactly the best security practice, but it does save energy vs firing up another machine, and the risk can be mitigated by periodic cash-out or transfer to cold storage (paper for me). Again, in this case I am choosing the energy saving option, and I am powering down a small highly firewalled system that in the past ran wallet software 24/7. Between all this, the miner at 550W is now running virtually for free if you count all the energy reductions, so why don't we CPU mine while we are at it? We will not just load our typical mining setup of EWBF's CUDA-based Zcash miner, but also xmr-stak, a highly capable Monero miner for the CPU. It will use half our CPU, or 2 cores, leaving enough power for the wallets and NAS to function. In an earlier column I talked about Monero not being worth it, but I feel it might be worth giving it another try, to see what comes out of it.
First, let's start with the wallets. We grab our wallet files and install the official Zcash client from source using the guide at the Zcash site. It's a simple CLI client, so I also load a Java-based SwingUI GUI from GitHub to pipe the commands and make management easier (note, the client is marked deprecated, but works fine). All this is compiled relatively easily in Gentoo, which is pretty much a complete development environment having gotten this far. The only thing I needed to emerge (install) to complete this is oracle-jdk-bin, which is the package for the Java 8 SDK needed to compile the SwingUI based GUI.
The GUI, when finished, imports the wallet fine and looks like this (probably time for a weekly cash-out, speaking of which!):Next, I install Electron Cash, a Bitcoin Cash light client wallet (I seldom hold Zcash, and this is where most of my coin is now for lower fees and higher liquidity at cash-out). It installs relatively easily as well, as it's based on Python and its dependency list is easily installable via porthole, the GUI package manager we already met earlier.
Note that there is an ebuild (Gentoo Package) for Electron Cash. Don't use it. It's woefully out of date and has dangerous security loopholes. Why it isn't blocked on the Gentoo repository is beyond me.
Now, with those set up, we can download the binary EWBF's CUDA miner, which installs easily because it is binary, and then xmr-stak, whose build guide is easy to follow and also installs easily and with few dependencies besides openssl and obvious things. We have them installed now and point them to our pools. They are waiting to fire up, but I have one more thing I want: Wine, which is a Windows emulator for Linux.
Why do I want Wine? Because I have a funky old UPS that carries my miner through short circuits that plague our location. It doesn't run long, but it allows it to shut down properly, and it stops short circuits from resetting everything. It's an Opti-UPS GS1100B, which is a known Windows-only non-HID compliant piece of crap that requires some Windows software to function. The Windows software communicates over a virtual COM port on USB, which surprisingly, the latest Wine supports. We emerge (install) it, and check .wine/dosdevices to make sure the mappings are right. We find our USB UPS COM port present on COM5 as a symbolic link to /dev/ttyUSB0Feeding that to the software gets us some figures:It passes a self-test, as evidenced in this screenshot; communication is thus working (note the load meter does not work during a self-test. It is normally at about 80%):
Now, finally, it's time to kick things online. I write some startup scripts, assign them to startup via settings-manager - Session and Startup in Xfce, and reboot. I am greeted by the following:We're mining happily, and the file server works fine. I'm even hosting a DLNA server on the side. I guess what I want you to take away from this as a miner is, your miner can do more than mining cryptocurrency. Consolidate. Just because we're miners doesn't mean we can't "think green." That's silly. Turn some things off and reduce your power and carbon footprint to compensate for the big one you'll be making while mining. Then, the next time someone calls you "mining scum" and accuses you of polluting the planet more than the average geek, you can happily prove them wrong. And why not? At least for a small-time miner, it isn't hard to do, it's fun, and that's part of why we IT types do everything we do, is it not? This guide isn't the only way, but there certainly are ways to accomplish what I'm saying. Get to it!
45 Comments on Confessions of a Crypto Miner: Green(er) Mining
Sounds like you're trying to clear your conscience in the face of the overwhelming dislike for mining activities among the users of this website.
My consience is clean but I still can do more, so why not?
Also, we are host to a great many miners here. I don't feel that anti-mining sentiment is "overwhelming" but it certainly is disproportionally noisy at times. The average miner likely has a lot of "nerd toys" around that consume a lot of energy. It doesn't have to be an NAS.
I also took a plasma screen down this week, but that was more because it toasted my room to a an uncomfortable temp. FWIW, the thing drew an average of 400W. Why not? I run a payment network without increasing my energy bill. Win win. What is the harm here? If anything, your argument has suddenly become against energy consumption in general. I bet it would shock you to find out I'm actually anti-POW... which is mining. :p I just don't have a better answer yet for what's to replace it. Part of why I am doing this article series is to learn it's pitfalls, and how to mitigate them until we have a better answer.
@R-T-B I might have another windows server license if you ever need it.
seriously, I don´t see AMD or Nvidia making new ( not rebranded) stuff for miners or gamers.
Been up to date was never so future proof.
You earn zero points from me and you should just stop already, its starting to look ridiculous. You're just justifying your own idiocy (and failing at it, mind you..)
'Greener mining'... they call that a Contradictio in terminis
Comments like this:
"Then, the next time someone calls you "mining scum" and accuses you of polluting the planet more than the average geek, you can happily prove them wrong. "
Its just painful to read.
That is exactly the problem today, people can't take feedback anymore, and have to resort to extremes instead, like censorship. Really odd.
The best way to keep this monster in check is to tax mining & the monetary gains, just make it incredibly hard for people to be instant millionaires overnight. I believe the reason this isn't happening is because big money & a large number of investors have enough friends in the establishment to make sure their gains aren't taxed.
Yes, I recognize this is useless to big farms who are the main offenders. But it still helps. And I am of the opinion cryptocurrency has good to do for the world yet, we are just in an infancy stage. Wishing it away when it clearly ISN'T going away isn't helping. I enjoy my mining project. He's... not entirely wrong. Out of curiousity, what is wrong with that logic? Serious question. My aim is not to justify mining (I view it as a silly if interesting enterprise), but to reduce it's impact.
What would you like to see more of vs this?
I basically just write "what I did last week" at this point, but I can write about other angles if it's wanted.
And yes, "green(er) mining" is an intentional contradiction. Plus the college I come from (Evergreen) has the somewhat deragatory local term "greeners" for the student base so it's a bit of an easter egg.
If you consume energy, you are contributing to global warming.
Greener mining is stopping mining. Not some story over your NAS.
If you consume energy, you are contributing to global warming.
Greener gaming is stopping gaming.
We all consume energy doing things we love. I make an article about how to compensate for that and somehow that's cowardly? I really can't see that. I try to understand all the replies but a lot of this just seems to be irrational hatred at the expense of logic.
Mining IS a flawed practice, but some of us enjoy it and do it as a hobby. A lot of things we as tech geeks do for a hobby consume undue amounts of power, but if every one of us tech guys tried to do a little of the above consolidation in any of our tech activities (mining, crunching, hosting, whatever) it could do some good. That's not cowardly, that's being productive. Cowardly is not giving a shit. We already heat the cold side of the house with the miner. One room only though, because unfortunately, 600W of power doesn't heat too much. It is still pretty cold here in Washington.
For the record, I am not pro mining and I have no plan to mine beyond years end (which was my original contractual term for the agreement with this article). This is more an experiment to see how an average miner can mine at full capacity and still reduce his impact (as well as maximize his profits... they are NOT mutually exclusive). I'm trying to solve a problem rather than whine endlessly at it. The way I see it, I'm doing a good thing. Something that actually can make a difference. You seem to miss that entirely.
This article obviously didn't strike the right chord. BESIDES just turning off my miner and quitting, which can't happen anymore than the world can be expected to stop crypto in general, do you have any suggestions on what the next piece should be? I'd love to hear them. I'm thinking about maybe a piece on how crypto functions and particularly, where it falls flat: The Proof of Work mining method we all have learned to hate, and maybe a brainstorm attempt on what could replace it. No, but at least it held it's own.
Edit: I would also like to point out that anyone that is concerned with the environment needs to find another hobby other than computers. We rape Mother Earth daily for the base materials to be able to manufacture these things we love to argue about.