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
Edit: Removed accidental quote
*Butthurt found in varying degrees, this statement doesn't apply to every non miner who can't get a video card at a decent price.
In all seriousness I'm looking forward to the cryptocurrency thing getting taken over by ASIC's so the GPU prices can get back to normal. Mining is an amusing thing to dabble in but I wouldn't actually invest money into hardware for it. I need to try Electron Cash, so far I've been using Jaxx and the mining fees seem fairly high 0.00017 charge for a 0.00180 deposit
You can mine like that and not on greedy needs.
I named you coward because you flushed away the fact that miners are a hell of a problem just with : "Mining inherently consumes a lot of energy, but a lot of things we do as tech geeks are actually not all that efficient". You couldn't even separate mining (which is a greedy activity) from benchmarking your computer or computing for things like Folding@Home. Seriously ? Is that so hard ?
You stated "and reducing a miner's impact on the environment" => Where can I find it ?
This article is about being greener. Not being a greener miner, sorry for being very harsh on you on this subject, but you can't tell things like that.
You can be "greener" only by not using greedy cards, that's all (and that's still to temper because you have to "trash" your card and buy a new one, with an ecological footprint).
Edit: www.qarnot.com/crypto-heater_qc1/
And in that regard I like this. R-T-B, as an IT enthusiast like most people on here are, has some interesting (albeit not necessarily useful) "gadgets" at home e.g. his NAS which is way too power hungry. In a german forum I also frequent there is a in comparison huge community of owners of HP Microservers. Also powerhungry and mostly only used as NAS devices.
Now R-T-B included his NAS into his mining rig. He shut down a device, that sucked 400W out the wall. He got rid of his "gadget NAS" that (and I'm assuming stuff here) he built completely overpowered and with too high of a power footprint with the intention of learning more about servers and maybe setting more stuff up on it, which never happened (again similar to this HP Microserver community I mentioned). So yes, hiw mining rig might consume 550W uselessly, but at the same time it replaced a 400W NAS and now has a "small" use (for R-T-B). Since I would now argue, that, since it was running reliably, R-T-B wouldn't have shut down the NAS in the course of this year anyways, he now used the opportunity and in comparison his mining rig is now "only" at 150W useless energy use compared to the status quo before R-T-B started his seeries of articles. At the same time, since his miner now runs on Linux, which in comparison to a Windows box is less propable to be attacked, he shut down another system that he heavily firewalled. BUT(!) this system was also only used for mining (in this case storing the wallet), so we can neglect the power saving here.
He then put a DLNA server on there and also gave us a nice tidbit about his UPS, which might be interesting to some people that for some reason use this UPS on a windows machine and want to switch to Linux.
I really hate mining, because it keeps me from gettingg a good and cheap GPU, even if used (I mostly buy used). Especially since my PC was stolen and I'm running on stuff that was donated to me by several friends. At least I can run my beloved Dota, barely.
But still, R-T-B himself stated, this series of articles is an experiment. So why hate on this?
Maybe it will give several more hardcore miners a good idea.
And now just imagine, if 100 miners have 400W servers/NAS running happily in their basement and transfer that into their mining rig now?
That'd be 40000W or 40kW saved in energy.
Every hour.
400kW in 10 hours.
Around 1MW a day.
It may be utopic, but as home-miners tend to be tech savy people the possibility of such servers existing in the hundreds is in my humble opinion relatively high.
Regards,
the German,
citizen of a country known for constantly seeing everything new and not inherent to our culture as negative and generally shit.
ASICs aren't an answer either because they just use more chips and end up consuming the same power. Been there, done that. Not if your electric bill doesn't increase overall.
The simple comparison to other activities we 'love to do' such as gaming does fly, but only in those specific cases where people 'mine a bit' because they love the technology. If you run a farm that is a steady source of income though, that becomes a very questionable statement. A gamer doesn't use twenty rigs to play games on simultaneously, he needs one. Just like you need only one to mine for 'fun'. And here's the kicker; if everyone mined 'for fun' like you, the whole basis of this article wouldn't even exist, because no one would even remotely care about the lost GPUs or the energy footprint of it.
Anyway, I see you're taking things on board, kudos for that.
I'm also not sure my logic is "false logic." It's sound logic, if you accept my premises. You may not of course, and that is your right to disagree I suppose.
I already have a good idea of the angle for my next article. Again, the goal of this series is to anaylze cryptos weaknesses and see what we can do about them. In that vein, my next article will cover Proof of Work... the demon inside every crypto coin and why it needs replacement very badly (and how hard that is to actually do).
Thank you all for the feedback.
What I would have more interest in reading about is real world uses of mining that result in MUCH more work produced. Not necessarily an article that shows block chain could be used for ________, or has the potential to someday do _______ (fill in the blanks)... But instead something that talks about current real world use cases. For instance, last year I came across an article about the Render Token (I believe this one was pointed out a few weeks ago by another commenter) and thought that it was a very interesting idea. This one in particular could be a great fit in the mining discussion, as it centers around computer graphics, 3D modeling, VR, and other scenarios that directly relate to the enthusiasts here at TPU. (or at the very least, maybe it will come off as a slightly useful case for mining to those who dislike it the most?) Anyways, just an idea...
edit: I had to go back and search after posting this, it looks like @cdawall mentioned rendertoken and a few others in an article on 2/1. Ill check out those mentioned there as well.
RTB comes to me every two weeks or so with ideas for the next article and I discuss+approve.
He does take suggestions from you, on what should be posted next, so feel free to share your thought with him, either in public or private, but please don't just hate.
If you ever need data to add into your editorial don't hesitate to shoot me a pm.
a NAS and a mining rig are pretty much at opposite ends of the spectrum. a NAS or game/web server should be built for rock solid uptime and reliability. as such whatever is running on it should be solid too. mining software is pretty raw at times, and (for the closed source miners) sometimes even shady quality. no way i would run or store anything sensitive (like wallets and personal files) on a mining rig. also mining software and video drivers tends to get updated fairly often on mining rigs, possibly requiring reboots, something pretty rare on my NAS
now a mining rig can be built for power optimization (or not, of course) and to do that you need to undervolt and possibly under clock the cards. this is much easier on windows than *nix at this time. although you can vbios mod and get around that, that can be risky, and not all miners like to mess with the vbios as it generally voids the warranty. different algos may want different voltages/clocks for the most efficient power or hash goals. finding these values often involve trying a setting and seeing if it crashes/BSODs/corrupts something. so easier to just use msi afterburner or something on windows. and these are definitely things not to do on a NAS or other type of server.
so guess it all depends on what your comfort level, hardware, software and algos are.
anyway, interesting build RTB.
EDITS: man i suck at spelling and grammar