Monero Mining on Raspberry Pis
Apparently mining Monero on Raspberry Pis seems to be all the rave now? So let’s try:
I had 5 Raspi 3B and one 4B 8GB lying around…
Mining In A Pool
Although you can download the official wallet and just start mining, the hash rate of your computer will most certainly be too small to ever solve a block and get a reward. So we will use a mining pool, where the work and rewards are distributed across all miners in the pool.
There are a lot of mining pools with different parameters around. I use xmrfast because they also pay out rewards as small as 0.005 XMR and I expect to not make much $XMR anyway. Also, it’s not a big pool so I contribute to the decentral nature of Monero.
Setup Ansible Scripts
So let’s set up some miners. As always I use Ansible to get rid of the repetitive tasks. You can use the scripts below as starting point. All you need is some 64bit Pis with SSH access and python3 installed.
That’s enough for the playbook, we will do the rest in the role:
So basically we download the source code, compile and install it and make a service out of it. The code is tailored to Raspi 4Bs with the explicit user “pi” and the “make -j4”. You should maybe adapt that to your needs.
The service file looks like this:
There, we reference the config file. Mine uses CPU only as we are on Pis and TLS to connect to the server. Don’t forget to fill in you Monero wallet address in user
.
That’s my host file:
Does it work?
YES! I also loaded a node-exporter on every Pi and logged to my Prometheus:
So how well does it work?
Here is the absolute hash rate of the Pis taken from the 15min average of xmrig. I included my Dell XPS 15 with a i9-9880HK and GTX 1650 as a comparison:
Now the Dell absolutely destroys both Pis. Although it’s interesting to see that the Pi 4B is nearly four times as fast as the Pi 3B. Also, the anti-CPU tactics of Monero seem to be working: The CPU is much more performant than the GPU.
But in Mining, absolute performance matters less than efficiency. So I measured the energy consumption of the 3 devices and divided the hash rate by it:
Again, the Dell CPU is far ahead, but less so, as it’s using 50W of power. The Pi 3B only uses 5.92W and the 4B 6W. In this test the GPU is the worst as the Laptop still uses 46W of power for the comparatively bad hash rate.
Of course measuring the Dell carries some uncertainties due to the included battery and automatic CPU throttling. Also I did not reinstall the system before the tests but I undervolted the CPU by 0.1 V. Anyway, you should start the miner with admin privileges. That nearly doubled the hash rate for me.
So what does all that mean in Euro? The following plot shows the expected earnings. I assumed my current energy price of 0.305 €/kWh and also the current $XMR price of €198.21:
So only the Dell CPU has any real chance of making profit. Excluding the cost of the machine, internet, cables etc., of course. And my energy cost would have to fall drastically. I guess I can forget about Mining in Germany.
And How Much Did I Earn Mining Monero?
Nothing. Although I had the Pis run over several weeks they stand no chance against the around 3 giga hashes already in the network. Even though I am mining with others, the pool will only pay above 0.005 XMR, which I did’t reach yet. The xmrfast page projects that I will earn around 0.0129 XMR in a year of mining with my Pis. That’s not much…
And Now?
I guess I need bigger machines. Maybe I can find some in the cloud…