• crypto
  • bitcoin

Mining crypto on my Linux PC

First, if you don't know what I'm talking about, read this. This post is not an in-depth discussion of what cryptocurrencies are, how they work, or why you might want to care.

If I had stuck with it then I'd be rich now

The first time I tried my hand at mining for cryptocurrency was back in 2011. I didn't know very much about it but I had access to some surplus hardware from work so I spent some time figuring out what I would need to do. Back then it was possible to mine "solo" and this is what I was doing, but in the short time I messed with it I never solved a single block and I got frustrated, thinking I was probably doing it wrong. Turned out of course that mining solo you could solve a block in a day or a million days, but quitting wasn't going to solve anything. Of course, in retrospect, I wish I had stuck with it a bit longer! To think its been so long there is actually a post on medium about Mining History. If I can find some details from my personal attempts at mining at that time I'll update this post.

I knew even at that time that although the surplus server I was using had a fantastic CPU that folks had already turned to GPUs (video cards) and even FPGA (field-programmable gate array) technology for the superior parallel processing they offered over CPU. ASIC boards (Application-specific integrated circuit) came to dominate the world of mining since then but they hadn't yet arrived on the scene. I am pretty sure I was using CGminer by Con Kolivas probably on Ubuntu.

Once I had gotten frustrated with solo mining I turned to joining a pool. Mining pools allow lots of users to contribute their efforts toward the common goal of solving the problem and increase the chance of success. The pool pays out a fraction to each contributor based on the number of "shares" they have contributed toward the effort. Back then the only pool I knew about was slushpool. There may have been some others but thats the one I remember. I still had the login info saved and was able to access my account but it was empty and I'm fairly sure I never managed to actually get any pool mining working back in the day. I had a mycelium wallet set up on my old android phone, but I know I never had any crypto in it.

Fast forward to today

Real life demands over the last couple months made many of my hobbies difficult or impossible. Since this left my music room empty and my nice rig off and idle I started to wonder if I could set it up to "mine crypto" while I was busy doing other things. I set a goal to acquire $1 in bitcoin soley through mining. This of course led to a bunch of reading on the topic. I quickly found that the difficulty these days is so high it makes mining bitcoin with a standard PC highly unprofitable; though many folks do mine alternative cryptocurrencies with a GPU and exchange these for bitcoin if desired.

The second most popular crypto coin today is Ethereum which is arguably more than just a digital currency, but can actually be considered a programming platform. Ethereum is one of the cryptocurrencies which is GPU-friendly, though probably not for long now as they have already announced that they will be shifting away from PoW (proof of work aka "mining") to PoS (proof of stake aka "investing") with Ethereum 2.0.

While it is still possible to do, Ethereum seems to be the coin to mine with my rig. At least 2Cryptcalcaccording to 2cryptocalc, which has an online calculator that lets you easily determine what the most profitable coin to mine would be based on your GPU. I have a GTX1660 Ti, and entering in a "1" into that GPU's location in the tool produces a list of cryptocurrencies and their estimated 24Hr profit if I used that card. The list shows ETH (Etherum) at the top for my card at $1.94 / 24Hr. If I had splurged on that 2080 back when I was building the rig that would be able to generate $3.55 / 24Hr! Of course, this is the value of ETH in US dollars at today's exchange rate and the value of ETH has been dropping of late so the profitability is going down.

The next obvious question is how much would the electricity cost to run my rig for 24 hours a day while mining? I happened to have a Kill A watt meter I could use to measure this. With the machine on, monitor off, and actively mining, my machine was using about 150W. KillaWatt Over a 24 hour period thats 3,600W or 3.6kW. Where I live electricity is fairly expensive at $0.11/kW which means it would cost about $0.40 /day in electricity to run. This would still mean a profit of $1.50 / day if you don't factor in wear and tear on your hardware. Given that I have not been able to use the machine much for anything else anyway lately, I decided it was worth the experiment.

Selecting a mining program

When I started out I hadn't yet done very much research and so I began at pretty much where I had left off in 2011. I struggled for a long time to compile cgminer and attempted to get that communicating before realizing it wasn't going to be efficient at all in my case. I searched for and read about lots of different mining softwares that supported running with a GPU and soon settled on bminer, a closed source application with a license issued by a company called "Chord Technologies". I assume the author may be Chinese or has many contacts there given that the site is available in English and Chinese. China has recently stamped down on crypto and mining. The only Chord Technologies I could find operates out of a residence in an upscale bedroom community of Fort Worth, TX. Other than those details, the author of bminer is a bit of a mystery which added to bminer not being open source would normally be more than enough for me to avoid it if my research didn't show that it apparently performs better than nearly every other miner software currently available. Releases of the software have been fairly constant since 2017, frequently supporting new alt-coins and offering new features.

Bminer's Linux release is a pre-compiled binary which "just works" and comes with a bunch of shell scripts you can edit to log into and mine against several different mining pools by replacing the information with your own. If you decide to test bminer without changing anything, or if you just plain don't know what you're doing those scripts are all set up to accept your kind offer of work against the author's key :) I admit I gave the author some time on my rig, just a few cents to help pay those electric bills.

Choosing a mining pool

2minersSince the author of bminer was actively promoting and using f2pool I decided to join that pool and start mining. I ran it for a time this way before I realized that the payout of this pool was at 0.1 ETH. With my single GPU rig I calculated that it would take 5,800 days at 24 hours a day to see a payout! It didn't take me long to find 2miners.com who seemed to be more friendly to beginners and have, since October this year, offered payouts for ETH mining at much smaller payout minimums in Nano or Bitcoin! I was confused by their advertising at first because I didn't notice that while a payout in Nano was indeed as low as 0.0005 ETH (something I could possibly do in a single day) and didn't incur any fees, payouts in Bitcoin (my goal, as you'll recall) was at 0.005 ETH and there was a small fee for the exchange. What's an order of magnitude between friends? Still, 2miners promised a faster payout and my goal was only a dollar in bitcoin, right? When I wanted to clarify their terms I used their support system (zendesk) to ask and got an answer almost immediately.

Getting a wallet

To mine, you need to mine TO an address. You can get an address through an exchange, but I personally didn't want to deal with an exchange and I didn't want anyone else to have access to my wallet. If you have your wallet "in the cloud" on an exchange I think its an increased risk because someone could potentially break into your account and steal it. Also, many of the exchanges require you to identify yourself with real world information to set up an account. Since these places aren't currently regulated (much if at all) I don't feel comfortable sharing any personal information with them. And I don't need to! I could use mycelium on android easily to create a wallet and address and I did set that up initially, but after some reading I decided to try using Exodus a highly rated wallet from J.P Richardson, a respected name in crypto based in Nebraska. Exodus is slick, if a bit slow. I set it up on my Linux PC but set it to sync to their app on my phone. Not using an exchange wallet means if I lose my password I'm out of luck, there is no way for Exodus to help me get back into it.

Started mining

Fired up the machine on Dec 5 around 9pm and mined over night. bminer does seemed to be churning away fine. Temperatures were nominal:

[INFO] [2021-12-06T06:47:14-05:00] [GPU 0] Speed: 25.17 MH/s Temp: 71C Fan: 61% Power: 104W 0.24 MH/J
[INFO] [2021-12-06T06:47:14-05:00] Total 25.17 MH/s Accepted/Rejected/Stale/Invalid shares 61/0/0/0

I didn't need to set up an account on 2miners.com to get started. Without one, though, I had to search with my wallet address manually to access a status page. Feel free to send me some bitcoin to this address if you're feeling generous!

2miners_rateI watched that page like a hawk, checking in every day, and it did take a while. It wasn't until Dec 18 that I finally reached 0.005 ETH and was paid out at the next payout time 7am on Dec 19. I had shut the machine down shortly after reaching the payout point and 2miners paid me out with the small additional ETH I generated up to that point.

It took some time for the transactions to flow from 2miners to the exchange they use and back, and then for them to pay out everyone who had contributed and for that payment to show up in my Exodus wallet, but it did!

Goal accomplished!

update 221119 as of today, Nov 19 2022 Exodus says my 0.0004156 BTC is worth $6.92 and my 1.2892176 Nano is valued at $0.76. Based on the $0.40/day estimate of electricity cost at the time (electricity is a lot more expensive today I'll note), it cost me about $5.20 to run my rig for those 13 days so I'm still up a couple bucks on this experiment.