monero mining on raspberry pi

How to Mine Monero Crypto Currency on Your Raspberry Pi

Mining crypto on our Raspberry Pi is a dream for many of us, and Monero is a good crypto for CPU mining. So, is it possible to mine Monero on your Raspberry Pi and get decent results? Let’s find out.

Mining Monero on Raspberry Pi is possible. The only requirements are a mining pool and mining software. Both are free and the setup can be done on most distributions with a few command lines.

I’ll start with a short introduction to make sure we’re on the same page with the vocabulary, and then I’ll show you all the steps to start mining Monero on your Pi. At the end, we’ll talk a little about profitability when mining on Raspberry Pi.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Introducing Monero

Let’s start with a few reminders to make sure you aren’t lost in the jargon of the technical part.

Cryptocurrency & blockchain

A cryptocurrency is a decentralized digital currency. This means it’s not managed by banks and governments.

It’s a fairly new concept, as the first cryptocurrency was Bitcoin in 2009. The decentralization of cryptocurrency is made possible by a technology called blockchain.

Blockchain is a distributed ledger that records all transactions across a network of computers, ensuring security and transparency without the need for centralized oversight.

Because it’s decentralized, it also means that anyone can be part of the chain. Either as a user (paying or receiving coins) or as a “miner”.

Miners play a crucial role in the cryptocurrency ecosystem by using their computer resources to process transactions and secure the network. In return for their contributions, miners are rewarded with cryptocurrency coins. The more resources you dedicate to mining, the greater your potential rewards.

Monero

Monero is one of the dozens of cryptocurrencies available, created in 2014.

This tutorial can work with any crypto, but I decided to go with Monero for two main reasons:

  • Mining Monero is more accessible to individuals using consumer hardware like CPUs, which is ideal for Raspberry Pi users.
  • It’s easier to achieve results with it compared to other cryptos.

If you mine Bitcoin, you’ll compete with giant GPU farms and will get way less than with Monero (which is already not much).

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Mining pool

A mining pool is essentially a network of miners.

When a block is found in a pool, all the miners are rewarded based on how much they helped the entire network get the block.

Joining such a network makes mining more accessible and profitable for individuals, as you can be rewarded without being the one who gets the block.

Mining software

To put everything together, we’ll use cryptocurrency mining software.

In short, once installed, it will make your Raspberry Pi resources available to the mining pool. You’ll start accepting jobs from the mining pool, and you’ll be rewarded every time the network makes progress.

I’m using XMRig in this tutorial, but other options are available.

How to mine Monero on your Raspberry Pi

Now that the vocabulary is clear, we can move on to the installation process. You’ll get better results 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.

Here are the main steps to start mining Monero on Raspberry Pi:

  • Get a Monero address (and wallet).
  • Get access to a mining pool.
  • Install and configure the mining software with the previous information.
  • Start mining!

Don’t worry, I’ll explain each step in detail now.

Get a Monero address

The first thing you need to do is to get your Monero address or create one if you don’t currently have one.

There are plenty of options to get one quickly.

The first option is to install and use the Monero wallet that is available on the official website. It’s a free GUI wallet created by the Monero community and is available for all operating systems. Once installed, you can see your address in the “Receive” section, and use it in the following of this tutorial.

But this tool is limited to Monero. If you’re interested in cryptocurrencies, you might want something more versatile where you can use other currencies as well (like Bitcoin, Ethereum, Dogecoin, etc.).

Personally, I’ll be using Exodus. It’s available on computers and smartphones and supports the most popular currencies. But you can find other options if you prefer, it doesn’t really matter.

In fact, you probably won’t receive any coins by mining on Raspberry Pi, so you can even use my address (or any random one) if you don’t want to waste time finding the best wallet.

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, Internet configured and SSH enabled, you can move to the miner installation.

Find a mining pool

Another thing you need to mine Monero on your Raspberry Pi is a mining pool.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

I didn’t test many, but I generally use “unMineable” for this. You can use it without having to create an account, it’s compatible with the software I’ll show you, and their fees are pretty standard (they keep 1% of your revenue).

Here is how to get the information we need to use it for Monero:

  • Go to their website, and click on Monero in the coins list.
  • You’ll see several options: Ethash, Etchash, Kawpow and RandomX.
    For a Raspberry Pi, we’ll use the CPU option, named RandomX.
  • Here is the direct link for RandomX and Monero.
  • What we need at this point is the server address and port.

    If you still have the same thing when reading this, the address is “rx.unmineable.com” and the TCP port “3333”.
  • Just below, you’ll see the explanation of how to set your user field:

    I’ll show you how to configure this in the next part.

You can try other mining pools if it works for you, the idea is always the same. The key point of this section is to get an address we’ll use in the miner.

Install the Monero miner

I recommend using XMRig to mine Monero on your Raspberry Pi. It’s free, easy to install and works easily with unMineable.

Here is the procedure to install XMRig on your Raspberry Pi:

  • Make sure you have all the prerequisites installed:
    sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
  • Clone the GitHub project on your device:
    git clone https://github.com/xmrig/xmrig.git
  • Create a new folder and go into it:
    mkdir xmrig/build && cd xmrig/build
  • Start the compilation:
    cmake ..
    make -j$(nproc)

It shouldn’t be too long. If everything goes well, you’ll see a file named “xmrig” in your build folder.

If you want to test XMRig on your computer after this, XMRig has releases ready for all major operating systems that you can download directly from their GitHub page (no need to compile it on other systems).

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.

Configure the miner for Monero and unMineable

It’s possible to run XMRig for Monero with all the parameters in a long command line, but I find it more convenient to use a configuration file so you can easily start and restart the mining process whenever you want.

Make sure you’re still in the XMRig build folder and download a configuration template from their GitHub project with this command:
wget https://raw.githubusercontent.com/xmrig/xmrig/master/src/config.json

You just need to address the server address, and your Monero address in this file:

  • Open the file with nano:
    nano config.json
  • Find the “pools” section.
    The only lines to change are the “url” and “user” variables.
  • Put your mining pool address in the “url” field, so if you are using unMineable it should be:
    rx.unmineable.com:3333
  • Then fill the “user” field as explained on the website:
    XMR:<address>.<worker_name>
    For example:
    XMR:48sB53XvFNHHGqieZWuu8zSDpxQCg8WxoBpPi46s6sEX95993eztCst9fN4c9FNndrj5XZvhVDhEX2LNkTxiLjnA8bbKEPP.rpitips
    If you use my address, please change the worker’s name to avoid any issues.
  • Save and exit (CTRL+X).

Start mining Monero

The executable name is “xmrig”, and the configuration file will automatically detect all the configurations.
So you can start mining with this short command:
./xmrig

A few seconds later, the mining process starts:

It might take a few minutes to receive new jobs for the miner pool, but if everything goes as expected, you should see lines like this popping up regularly:

You can also check the unMineable website to check your results. If you type your Monero address on the page where you got the server address, you’ll see your active miners, the hash rate and your balance updated:

Well done, you’re now mining Monero 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 200H/s ratio, you won’t earn anything on Raspberry Pi (and I’m testing this on a Raspberry Pi 5!).

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

If you consider the Raspberry Pi cost, and the electricity cost, 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.

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

Also, remember that unMineable won’t send you anything to your address until you reach 0.03XMR, which might take a couple of years at this rate.

🖋 Love Raspberry Pi & writing?
Combine your passions and get paid. Write for RaspberryTips!

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.

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

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Video

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

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!

Conclusion

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

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

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: 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.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

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

Similar Posts

50 Comments

  1. 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

    1. Hi Jose,

      This package is available in the Raspbian repository

      Did you try “apt install libcurl4-openssl-dev” ?

  2. Hey! I’m getting this:

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

    Any thoughts? I googled but was unsuccessful.

    1. Hi kurt,

      Could you try ./build-linux-arm.sh ?

      That’s the file full name

      Let me know, so I can edit the command in post

      1. Hi

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

        1. Hello,

          Can you try ./build-linux-arm.sh ?

          If it’s ok I will edit the post

          On Github there is a file named build-linux-arm.sh, so it should be that

  3. 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?

  4. 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?

    1. Hi,

      Nope no ideas
      And I tried this tutorial this week on Raspberry Pi 4 to see if the results are better and I didn’t see major issues with Buster

      Are you using Minergate or another pool?
      With Minergate you can probably ask them
      check this link: https://minergate.com/faq/invalid-shares

    2. 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

  5. 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+)

      1. 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

  6. Hello,

    Just tested this on Buster, and it works perfectly

    As Mike wrote, we can now use “./build.sh”
    I’ll edit the tutorial immediately to avoid this issue

    And yes, you need to be in the correct path to execute the cpuminer command
    Or use the complete location: /opt/cpuminer-multi/cpuminer

  7. 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

    1. Hi Chris,

      The command is : sudo ./build.sh

      Make sure you’re in the correct folder

      This post was updated 3 weeks ago for Buster, so it’s working as explained

      Let me know if you have other issues

  8. 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?

    1. Hi smoke,

      Make sure you are in the correct path before running ./cpuminer
      cd /opt/cpuminer-multi if you have followed the tutorial

      This post was made on RPI 3, so you should get the same results

      Patrick

  9. 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

    1. Hi,

      If it was working before, it’s probably an issue with the server
      Your installation is correct but the server doesn’t work

      You may need to try other servers or to contact Minergate

      Patrick

  10. 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.

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

  12. 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.

  13. 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”

  14. 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.

  15. 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

  16. 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. 🙁

  17. 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?

      1. 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 http://www.DeepL.com/Translator (free version)

        1. 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

  18. Hello,

    I just tested and updated this tutorial today.
    Everything works fine (the MinerGate website was a bit laggy, but probably a temporary issue).

    On Raspberry Pi 4, the results are much better, but still no profitability due to electricity cost 🙂
    Patrick

  19. 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 🙂

    1. Salut Gaëtan,
      You can try this tutorial: raspberrytips.com/autostart-a-program-on-boot/

  20. 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

    1. You missed two commands in the procedure (configure and build)
      Patrick

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

Comments are closed.