One day awhile back I chose to learn about a cryptocurrency that previously I knew nothing about. The pick was Monero, a coin (at the time) ranked thirteenth by market cap on coinmarketcap.com and eighth by price. What I found interesting about this coin was the mining algorithm, CryptoNight.
CryptoNight is another proof-of-work algorithm much like the ones we find in Bitcoin, Litecoin, and many other coins. The focus for this algorithm is to keep the hashing power manageable. This way, someone mining on a CPU can still gain a portion of the pool's reward. Of course, the better the CPU, the more hashes per second the miner receives.
This algorithm also supports GPU mining but the advantage over CPU mining is not enormous. Take Ethereum, for example. While it was/is still proof-of-work, using a GPU would return 100 times more profit. Monero, on the other hand, is able to keep the GPU advantage at a mere two times the performance.
Keeping the spread on hashing power between CPUs and GPUs so low, as well as the lack of ASICs, keeps Monero decentralized to the fullest. More individuals are able to mine this coin on the computer they own and see returns, especially when the price increases. We all know that a coin's ability to remain decentralized is key to its success and longevity.
How To Mine Monero on Linux with an AMD Graphics Card
We will use the xmr-stak application created and maintained by fireice and psychocrypt on GitHub. This is what I use and everything is running great. If you want to mine with a GPU, I suggest installing a flavor of Ubuntu 16 or higher on whatever computer is doing the mining. If you plan to only use your CPU to mine, then use whatever distro you'd like. I was on pure Debian the first time I tried this and ran into many issues. Ubuntu was a much smoother install in getting the GPU to mine.
CPU: AMD Ryzen 7 1700 RAM: 16 GB of Corsair Vengeance LPX DDR4 Drives: 1 SSD (OS and Programs) and 1 HDD (files) Graphics Card: Sapphire Radeon NITRO R9 390 8GB Power Supply: Corsair RM750i Operating System: Linux Internet Speed: 50mbps upload & 50mbps download
With that computer I am pumping out between 1,000 and 2,000 hashes per second. This is when both the CPU and GPU are mining together. The CPU alone can run 300 hashes per second at 50 percent usage, while the GPU runs at about 700 hashes per second, on average. These numbers fluctuate a lot and I once saw the combined total at 2,500 hashes per second for a short while.
We are going to assume you have Ubuntu installed since using a GPU will almost always give more hashing power. What we need to do first is to install the proprietary AMD graphics drivers. Not ideal if you want a computer that is 100 percent FOSS but is needed to mine cryptocurrency.
We need to follow this guide from AMD to properly install the 'AMDGPU-PRO' driver into Ubuntu. We will not walk through that step by step since the site lays it out perfectly. Once the 'AMDGPU-PRO' diver is installed, we now need to install the AMD APP SDK. Download the latest and follow the install directions. I advise running these two installs as the root user for system-wide access.
Now that we have all the proprietary software installed, it is time to compile the 'xmr-stak' application. Open up a terminal window and navigate to the directory in which you wish to run the program. I used my 'home' directory and will be using that in my command examples here.
Once we are in the the directory of our choice, it is a good time to install the dependencies. Enter the following:
sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev
Once that is complete we need to download the source from Github:
git clone https://github.com/fireice-uk/xmr-stak.git
Next we need to make our directory to build the application, then navigate into the same directory:
Now we compile the source code. Below is what to enter in order to have both our CPU and AMD GPU mine together:
cmake .. -DCUDA_ENABLE=OFF
-DCUDA_ENABLE=OFF tells the compiler that we do not need to compile for an NVIDIA graphics card. If we do not state this, the compiler will fail since we only have an AMD graphics card.
If we only want to mine with a GPU, then enter the following:
cmake .. -DCUDA_ENABLE=OFF -DCPU_ENABLE=OFF
Now to install run:
Running The Monero Mining Software
Now that we have the software installed to mine for Monero, we can run the program. Make sure before you start the miner that you have a wallet and pool you can use.
When the xmr-stak is run for the first time, it will ask a series of questions to set up the configuration file. After that, it analyzes the hardware we chose to use and determines the best settings for the most hashes per second.
To run the miner we need to navigate to the bin directory:
Once there all we need to do is run:
Now that the program in running, there are some key shortcuts we can use to monitor how everything us operating.
h will display the hashes per second on every GPU and CPU we have in the computer.
c displays information about the connection to the pool and
r to show the mining results.
That is all there is to it! Looking at it typed out like this makes it seem quite easy. There was much back and forth in my attempts to get my GPU to mine. I hope my weekend project of trial and error saves you as much time as possible so you can reap as much Monero as possible!
Ways to support the blog.
If you are an email kind of nerd you can sign up for mine here. You can donate to this site from my Liberapay account if you so choose. If you want a more passive way to support this site, use this link when shopping on Amazon; it kicks some of Amazon's profit to me at no extra cost to you.