How to Mine Monero Crypto Currency on your Raspberry Pi


You probably already asked yourself about mining with your Raspberry Pi.
Now that Bitcoin is becoming very hard to mine, Monero is the new Bitcoin.
In this tutorial you’ll learn how to mine Monero on Raspberry Pi.

Mining Monero on Raspberry Pi is easy when you have good tools.
You can download and install a miner for free, to start mining a few minutes later.
You also need an account on a mining pool to do this (I’ll show you how).

So, let’s start learning a little more about this topic.
I’ll start with a short introduction about cryptocurrencies, Monero and mining pool.
Then we’ll see how to install a miner on your Raspberry Pi.
And finally, we’ll talk a little about profitability when mining on Raspberry Pi.

Best way to make money with a Raspb...
Best way to make money with a Raspberry Pi - Better than crypto mining! (EarnApp)

What is Monero?

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!

Crypto currencies reminder

A cryptocurrency is a decentralized digital currency.
This means that it isn’t managed by banks and states.

It’s a recent concept, and the first cryptocurrency was Bitcoin in 2009.
As it is decentralized, it allows anyone to be a part of the chain.

By being a part of the network, you lend your device resources to the community to help the network.
And the system can reward you, it’s what we call a miner.
The more resources you have, the more cryptocurrency you’ll get.

Monero

Monero is one of these cryptocurrencies, created in 2014.

I chose Monero for this tutorial, rather than Bitcoin because it’s easier to get something.
In the Bitcoin network, there are big miners, and most of the time you can’t get anything with a standard computer.
So, with a Raspberry Pi it’s even worse …

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

The advantage of Monero is that normal people with a classic CPU can help to get rewards.

Mining pool

Just a few words about the mining pool as we’ll use it later.

A mining pool is simply a network of miners.
When a block is found in a pool, all miners get rewarded depending on how they helped the entire network achieve this.

How to install a miner on your Raspberry Pi

Now that the vocabulary is clear, we can move on to the installation process.
You’ll get better result with a high-end Raspberry Pi model (I’m using this one for this tutorial), but any model should work if you just want to test it.

Create a MinerGate account

The first thing you need to do is to get access to a mining pool.
I recommend creating a MinerGate account.
It’s simple and you can use it anywhere, not only on Raspberry Pi.

  • Go to the MinerGate registration form.
  • Fill out the form.
    minergate registration
  • Confirm your email and log into your account.
  • On the Dashboard, you can check which currency you are currently mining and your winnings.
    We’ll check that later.
  • In the main menu, click on Mining Pools > Monero.
  • Scroll down the page to the mining pool information:
    minergate monero pool
  • Keep this information safe, you’ll need it later.

Install Raspberry Pi OS

If you already have Raspberry Pi OS on your Raspberry Pi, you can move to the next paragraph.

If not, you can check my post on how to install Raspberry Pi OS and come back here later.
Once you have Raspberry Pi OS installed, the Internet configured and SSH enabled, you can move to the miner installation.

Install the Monero miner

To mine Monero, we’ll use the cpuminer-multi tool from Tanguy Pruvot.
You can check the GitHub project here.

Follow these steps to install it on your Raspberry Pi:

  • I recommend connecting to the Raspberry Pi via SSH.
    So you can just copy/paste commands from this page.
  • Update your system:
    sudo apt update
    sudo apt upgrade
  • Install all needed dependencies:
    sudo apt install git automake autoconf libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev
  • Go into the folder you want to install in and run these commands:
    cd /opt
    sudo git clone https://github.com/tpruvot/cpuminer-multi
    cd cpuminer-multi
  • You can do the compilation and installation with:
    sudo ./autogen.sh
    sudo ./configure
    sudo ./build.sh
    This can take some time on Raspberry Pi.

After this, your miner is ready to use.

Are you a bit lost in the Linux command line? Check this article first, for the most important commands to remember, and a free downloadable cheat sheet so you can have the commands at your fingertips.

Run it

The executable name is “cpuminer”.
I give you the entire command here:
./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u YOUR_EMAIL

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Replace YOUR_EMAIL with the email address you use to login on MinerGate.
Your password is not required.

A few seconds later, the mining process starts:

mining monero cpuminer

If you go back to the MinerGate dashboard, you can see the miner online.

That’s it, you’re mining on your Raspberry Pi!

Thoughts about mining on Raspberry Pi

Profitability

After this little excitement, let’s get back to reality.
In this profit calculator, we can convert H/s into profit estimation.

Even if I remove the electricity cost, with a 2H/s ratio, you won’t earn anything on Raspberry Pi 3B+.

monero profitability raspberry pi

This simulation shows us a $0.27 gain after one year.

If you consider the $35 of the Raspberry Pi (minimum), and the electricity cost (probably around $0.10 a week), you’ll lose money by mining Monero on your Raspberry Pi. That’s why I recommend other options to make money with a Raspberry Pi in this article, as crypto-mining is not the best choice.

And even if you can get a free Raspberry Pi and free electricity, this is not a good deal.
Raspberry Pi 4 has more hashing power (about 12H/s), but still not enough to make you rich :).

Building a Raspberry Pi cluster might seem a good idea to get better results, but it wouldn’t be more profitable if you look at the profit/power ratio.

Education

Even if it’s not profitable, you can learn many things by installing a miner on your Raspberry Pi.
It doesn’t cost a lot and the installation is rather easy, so it’s a good first step in the cryptocurrency world.

Master Python on Raspberry Pi
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.

You can now try it on bigger devices and win a little with cryptocurrencies 🙂

Video

If you prefer, here is a video I made on my YouTube channel to explain the steps to mine Monero on Raspberry Pi:

Related questions

My Raspberry Pi is heating when mining, what can I do? The mining process takes all the power of your CPU, so heating is normal to see. If you want to avoid this, you can mine with less CPU, by adding the -t option to the cpuminer command (“-t 2” for example, t stands for threads).

How to use MinerGate on other platforms? Create an account on MinerGate, then click on “Downloads” in the main menu. Choose the download file corresponding to your computer operating system (Windows/Mac/Ubuntu) and GPU, then install it. You’ll get a better rate on your computer. Here is an example on my laptop:
minergate mining on windows

Reminder: Remember that all my Patreon supporters get access to this website without ads, early access to my videos and much more. You can become part of this community for as little as $3 per month & get all the benefits immediately.

Conclusion

Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

That’s it, you now know how to mine a cryptocurrency (Monero here) with your Raspberry Pi, and on any Linux system.

I’m not an expert in cryptocurrency, so if you see some mistakes or have other suggestions for readers to enjoy this post, feel free to contact me.

If you want to try other cryptos with another miner, you can read my recent article on how to mine Dogecoin on Raspberry Pi.

Raspberry Pi Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.

VIP Community
If you just want to hang out with me and show your support, you can also join the Patreon community. I share behind-the-scenes content there and give you early access to my content. You’ll also get a shoutout when you join.
More details here.

Need help building something with Python?
Create, understand and improve any Python script for your Raspberry Pi.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

You can also find all my recommendations for tools and hardware on this page.


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

0 0 votes
Article Rating

Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Subscribe
Notify of
guest
50 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jose
3 years ago

Good day,

I dont know exactly when was this posted but i got a message on my Pi that (libcurl4-openssl-dev) was not found, any ideas on how to proceed?

Thanks,

J

kurt
kurt
2 years ago

Hey! I’m getting this:

sudo: ./build-linux-arm: command not found

Any thoughts? I googled but was unsuccessful.

Shai
Shai
Reply to  Patrick Fromaget
2 years ago

Hi

Have the same issue as Kurt, I tried ./build-linux-arm.sh but still same message: no such file or directory

kabi
kabi
Reply to  Patrick Fromaget
2 years ago

with .sh it work.
Thanks for the notes..

Bill
Bill
2 years ago

Hi, I have been trying to do this on multiple websites, but all have been unsuccessful. None of the commands are working. Not even apt-get update. It runs for a while, but then returns a bunch of 404 errors. Any ideas?

Herman
Herman
2 years ago

Hi, Thanks for the awesome post first.
I started mining Monero as this tutorial, but I always got “invalid shares” on Dashboard.
Any ideas about this issue?

Jan
Jan
Reply to  Herman
2 years ago

Hi Herman, is there any chance you’d be able to upload an image of your setup. I’ve been trying to get this working for ages, have had to reinstall raspian from scratch 5-6 times. If you’ve got it working I’d be so grateful for a copy. Obviously, a version which is safe for you to upload, with your wallet info and wifi passwords removed etc. If you can, you can, if you can’t thats fine too. Thanks in advance, Jan

Jan
Jan
2 years ago

Just feeding back: It also didn’t work for me when I did sudo ./build-linux-arm but it DID work when I did sudo ./build-linux-arm.sh

It definately needs the sh on the end

So far so good.
The final step (sudo ./build-linux-arm.sh) takes about 2 minutes.

While doing sudo ./build-linux-arm.sh, I encountered the following error:
“algo/rainforest.c: In function ‘rf_crc32_32’:
algo/rainforest.c:411:7: error: ‘rf_crc32_table’ undeclared (first use in this function); did you mean ‘rf_crc32_32’?
crc=rf_crc32_table[crc&0xff]^(crc>>8);
^~~~~~~~~~~~~~
rf_crc32_32
algo/rainforest.c:411:7: note: each undeclared identifier is reported only once for each function it appears in
algo/rainforest.c: In function ‘rf_add64_crc32’:
algo/rainforest.c:461:7: error: ‘rf_crc32_table’ undeclared (first use in this function); did you mean ‘rf_crc32_32’?
crc=rf_crc32_table[crc&0xff]^(crc>>8);
^~~~~~~~~~~~~~
rf_crc32_32
make[2]: *** [Makefile:2410: algo/cpuminer-rainforest.o] Error 1
make[2]: *** Waiting for unfinished jobs….
mv -f algo/.deps/cpuminer-pluck.Tpo algo/.deps/cpuminer-pluck.Po
mv -f algo/.deps/cpuminer-neoscrypt.Tpo algo/.deps/cpuminer-neoscrypt.Po
mv -f sha3/.deps/cpuminer-sph_radiogatun.Tpo sha3/.deps/cpuminer-sph_radiogatun.Po
make[2]: Leaving directory ‘/opt/cpuminer-multi’
make[1]: *** [Makefile:2881: all-recursive] Error 1
make[1]: Leaving directory ‘/opt/cpuminer-multi’
make: *** [Makefile:694: all] Error 2
Compilation failed (make=0).
Common causes: missing libjansson-dev libcurl4-openssl-dev libssl-dev
If you pulled updates into this directory, remove configure and try again.”

(31/08/19, clean raspian install, raspberry pi 3B+)

Marc
Marc
Reply to  Jan
2 years ago

i have the same errors but don’t know what to do

Brady
Brady
Reply to  Marc
2 years ago

Has there been any resolution to this? I am having the same issue, ending with:
Compilation failed (make = 0)
Common causes: missing libjasson-dev libcurl4-openssl-dev libssl-dev

Marc Desiaume
Marc Desiaume
2 years ago

This software is obsolete

ben
ben
2 years ago

where do you executethe command to run? is it in the cd for cpuminer or just normal??

Mike
Mike
2 years ago

Not ./build-linux-arm… Just ./build

Brady
Brady
2 years ago

Same error. Was there ever a fix for this?

Chris
Chris
2 years ago

Hey! I’m getting this:

sudo: ./build-linux-arm.sh: command not found

Any thoughts?
i have tried
./build.sh
./build-linux-arm.sh
all to no luck

smoke
smoke
2 years ago

Hi, I am having problems when running it. When trying to run it I have this error message.
sudo: ./cpuminer.l: command not found
What can I do?
PS: I have a Pi zero V3, what is the hashing power of it?

Andrew Bower
Andrew Bower
2 years ago

Hi, I got this working just fine however it appears to crash after a random amount of time like the example below – anyone know what this means? Everything is up to date.

pi@Monero:/opt/cpuminer-multi $ ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u
** cpuminer-multi 1.3.7 by tpruvot@github **
BTC donation address: 1FhDPLPpw18X4srecguG3MxJYe4a1JsZnd (tpruvot)

[2020-02-03 16:59:16] Using JSON-RPC 2.0
[2020-02-03 16:59:16] CPU Supports AES-NI: NO
[2020-02-03 16:59:16] Starting Stratum on stratum+tcp://xmr.pool.minergate.com:45700
[2020-02-03 16:59:16] 4 miner threads started, using ‘cryptonight’ algorithm.
[2020-02-03 16:59:17] Stratum difficulty set to 2000
[2020-02-03 16:59:39] CPU #3: 3.05 H/s
[2020-02-03 16:59:39] CPU #2: 3.03 H/s
[2020-02-03 16:59:40] CPU #0: 2.96 H/s
[2020-02-03 16:59:40] CPU #1: 2.94 H/s
[2020-02-03 16:59:54] CPU #2: 3.03 H/s
[2020-02-03 16:59:54] accepted: 1/1 (diff 0.000), 11.98 H/s yes!
[2020-02-03 17:00:21] CPU #1: 2.93 H/s
[2020-02-03 17:00:22] CPU #0: 2.91 H/s
[2020-02-03 17:00:43] CPU #3: 2.83 H/s
[2020-02-03 17:00:44] stratum_recv_line failed
[2020-02-03 17:00:44] Stratum connection interrupted
[2020-02-03 17:00:44] CPU #0: 2.68 H/s
[2020-02-03 17:00:44] CPU #1: 2.77 H/s
[2020-02-03 17:00:45] CPU #2: 2.87 H/s
[2020-02-03 17:01:26] CPU #3: 2.96 H/s
[2020-02-03 17:01:26] CPU #2: 2.92 H/s
[2020-02-03 17:01:27] CPU #1: 2.87 H/s
[2020-02-03 17:01:28] CPU #0: 2.80 H/s
[2020-02-03 17:01:35] stratum_recv_line failed
[2020-02-03 17:01:35] Stratum connection interrupted
[2020-02-03 17:01:35] CPU #3: 2.06 H/s
[2020-02-03 17:01:35] CPU #2: 2.48 H/s
[2020-02-03 17:01:35] CPU #1: 2.78 H/s
[2020-02-03 17:01:35] CPU #0: 2.42 H/s

niko
2 years ago

stratum_recv_line failed
any idea what would cause this error?
worked all night without failure

wendigo
wendigo
2 years ago

stratum_recv_line failed
and is not a pool server issue (same time mining with other PC and their software is all ok)
I’m thinking Minergate won’t support mining from armhf hardwares.

Mark
Mark
2 years ago

Unable to mine XMR after update

Matt Ray
Matt Ray
1 year ago

Just got this up and going with zero problems on Raspbian. Very good guide and thank you so much!

Vinny
Vinny
1 year ago

Thank you for this! I just got this up and running on my Raspberry Pi 4!

I do have the errors coming up as it is mining… “stratum_recv_line failed” or Stratum connection interrupted” but I figure that is probably my connection. It always keeps going.

Oh, and a tip – When you set up your Minergate account, verify your email before you start mining. Otherwise it doesn’t count you as active.

Vinny
Vinny
1 year ago

Well I had it working, but for some reason now it keeps just timing out. Not sure what I did wrong. Too late to figure it out tonight.

I will say this though, make sure you verify your email account before you start mining. Otherwise it counts your shares as “invalid”

Vinny
Vinny
1 year ago

Last night I got this running at first, and actually had it running a few hours, but at some point all I get are error messages. Like the commands work, but all it keeps spitting back out at me is

stratum_recv_line timed out
…retry after 10 seconds

I tried updating my system again this morning because I left it running all night, hoping it would get through again, and it looks like it did, but I did a couple times, but I never got any shares on my dashboard after I went to bed. And now it does not even show that I am mining or trying to.
Also, I do not even see the process running if I open another terminal and run htop, even though it is clearly doing something.

Not sure where to check to get it working again, and any insight would be appreciated.

Noobs pie
Noobs pie
1 year ago

I tried it with my raspberry pi 3 and when i use the ”sudo ./build.sh” the pi reboot and i cant make it work

Abnoba12
Abnoba12
1 year ago

I was used this miner on my PI for one night with minergate, but I think this miner is too far out of date. As a result of it being so out of date the miner causes a lot of invalid shares resulting in the mining pool to banning you. When you are banned you can connect but the pool will never send you any hashes, so it just sits there like it isn’t working.

I was excited to setup an array of PIs and play around with CPU mining, but I have not been able to find any up to date miner that will work on a PI. I think most coins have gotten too difficult for a PI to handle. 🙁

Dave
Dave
1 year ago

Hello, I got everything working on Pi 4 B 8GB on the first install, after shutting down the pi i cant seem to get the miner working again. I’m a noob to the pi world and using Raspbian so I’m not familiar with a Linux system. I’m a PC user. How do i start the miner when I turn the pi back on?

Leo
Leo
Reply to  Patrick Fromaget
1 year ago

Hello, I have the same problem. When I reboot and go to the path “/opt/cpuminer-multi $” and enter the start command (./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u myemailadress) it only gives errors:

[2021-01-08 23:54:28] Using JSON-RPC 2.0
[2021-01-08 23:54:28] CPU Supports AES-NI: NO
[2021-01-08 23:54:28] Starting Stratum on stratum+tcp://xmr.pool.minergate.com:45700
[2021-01-08 23:54:28] 4 miner threads started, using ‘cryptonight’ algorithm.
[2021-01-08 23:55:28] stratum_recv_line timed out
[2021-01-08 23:55:28] …retry after 10 seconds
[2021-01-08 23:56:38] stratum_recv_line timed out
[2021-01-08 23:56:38] …retry after 10 seconds

And this doesn’t stop anymore. Can you help me or do you know why this is happening. Did I do it wrong?
Anyway, thanks for the tutorial, everything worked smoothly.

Translated with www.DeepL.com/Translator (free version)

Daniel Chenoweth
Daniel Chenoweth
Reply to  Leo
1 year ago

I am having the exact same problem with my Pi4 8GB. Has there been a fix for this yet? Has anyone else had this problem?
Thanks. 02-15-20221

Rohan J
Rohan J
1 year ago

Hello,
Can the above code used in Ubuntu Mate on raspberry pi?

Gaëtan
Gaëtan
1 year ago

hi everyone,

can someone explain me if there is a solution to boot it automatically on start up?
if there is i’m a 100% noob so be gentke, thanks 🙂

Max
Max
1 year ago

Nice tool to see errors on the screen.

smokingfox
smokingfox
1 year ago

pi@raspberrypi:~ $ cd /opt
pi@raspberrypi:/opt $ sudo git clone https://github.com/tpruvot/cpuminer-multi
Cloning into ‘cpuminer-multi’…
remote: Enumerating objects: 4265, done.
remote: Counting objects: 100% (173/173), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 4265 (delta 73), reused 167 (delta 73), pack-reused 4092
Receiving objects: 100% (4265/4265), 19.47 MiB | 1.60 MiB/s, done.
Resolving deltas: 100% (2904/2904), done.
Checking out files: 100% (293/293), done.
pi@raspberrypi:/opt $ cd cpuminer-multi
pi@raspberrypi:/opt/cpuminer-multi $ sudo ./autogen.sh
configure.ac:15: installing ‘./compile’
configure.ac:4: installing ‘./config.guess’
configure.ac:4: installing ‘./config.sub’
configure.ac:9: installing ‘./install-sh’
configure.ac:9: installing ‘./missing’
Makefile.am: installing ‘./depcomp’
pi@raspberrypi:/opt/cpuminer-multi $ ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u xxx@xxxxxx
-bash: ./cpuminer: No such file or directory

Ole Michael
Ole Michael
1 year ago

Help, it only submits invalid shares! What did I do wrong?

Philip Knight
Philip Knight
1 year ago

Well its back again
error stratum_recv_line failed and wont work anymore.

Adeyanju
Adeyanju
Reply to  Philip Knight
1 month ago

Has that issue been fixed or it’s still at it?

Recent Posts

Master your Raspberry Pi - 10% off