How to Mine Monero Crypto Currency on your Raspberry Pi


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

How to mine the Monero crypto currency on your Raspberry Pi?
Mining Monero on Raspberry Pi is easy when you have the 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 crypto currencies, 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

What is Monero?

Crypto currencies reminder

A crypto currency is a decentralized digital currency
This means that it’s not managed by banks and states

It’s a recent concept. The first one 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 crypto currency you’ll get

Monero

Monero is one of these crypto currencies, created in 2014

I choose 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 …

The advantage of Monero is that normal people with a classic CPU can help and 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 achieving this

How to install a miner on your Raspberry Pi

Now that the vocabulary is clear, we can move on to the installation process

Create a Minergate account

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

  • Go to the Minergate registration form
  • Fill 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 Raspbian

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

If not, you can check my post on how to install Raspbian and come back here later
Once you have Raspbian installed, 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

    It can take some time on Raspberry Pi

After this, your miner is ready to use

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

Replace YOUR_EMAIL by the email address you use as a 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’ll not earn anything

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

And even if you can get a free Raspberry Pi and free electricity, this is not a good deal

Education

Even if it’s not profitable, you can learn many things by installing a miner on your Raspberry Pi
As it doesn’t cost a lot, and the installation is rather easy, it’s a good way to make a first step in the crypto currencies world

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

Related questions

My Raspberry Pi is heating when mining, what can I do? The mining process take all the power of your CPU, so it’s normal to see that kind of thing. 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

Conclusion

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

I’m not an expert in crypto currency, so if you see some mistakes or have other suggestions for readers to enjoy this post, please share in the comments below

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.

35 thoughts on “How to Mine Monero Crypto Currency on your Raspberry Pi

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

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

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

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Content