Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Use A Raspberry Pi And A CPU Miner To Mine Altcoins

TwitterFacebookRedditLinkedInHacker News

I’m a big fan, and hoarder, of Raspberry Pi devices. If you’ve seen my previous Raspberry Pi tutorials, you’ll know I like using them for hardware and software projects. These microcomputers use very little energy and have decent processors and memory, making them great for a diverse set of projects.

With blockchain and cryptocurrencies on the rise, Raspberry Pi devices become great for getting familiar with concepts such as wallets, mining, and synchronized nodes.

We’re going to see how to mine Altcoins with a Raspberry Pi and a popular CPU miner.

Going forward, you must note that it is very unlikely that you’ll be able to harvest coins with a single Raspberry Pi unless you find an Altcoin that is new. While these microcomputers are useful, you need extremely powerful computers to mine established coins like Bitcoin. Don’t let this deter you because the concepts are valid and it makes a fun project.

If you haven’t already prepared your Raspberry Pi, read my tutorial titled, Use Your Raspberry Pi as a Headless System without a Monitor. It will help you get Raspbian installed and configured. After getting started with Raspbian, you can learn how configure wireless here.

Building the CPU Miner for Linux and ARM

There are many different cryptocurrency mining softwares in circulation. There are popular CPU miners, GPU miners, mixed miners, and variations of each. The Raspberry Pi has a hardly existent GPU, so we’re going to focus on CPU mining.

The most popular CPU miner is called cpuminer and it is maintained by pooler on GitHub. The catch here is that you can only mine coins that use the SHA-256 and scrypt algorithms with cpuminer. Instead, we’re going to explore a variation of cpuminer called cpuminer-multi which has significantly more supported mining algorithms.

To build cpuminer-multi, SSH into your Raspberry Pi and execute the following commands:

sudo apt-get update -qq
sudo apt-get install -qy automake autoconf pkg-config libcurl4-openssl-dev libssl-dev libjansson-dev libgmp-dev make g++ git

The above commands will update your package repositories and install the necessary dependencies for building Linux applications from source. Remember, we’re using a non-typical architecture and probably won’t find a prebuilt binary.

With the Raspberry Pi prepared for building, we can build the miner. From the SSH session, execute the following:

git clone https://github.com/tpruvot/cpuminer-multi -b linux
cd cpuminer-multi && ./build.sh

The above commands will clone the cpuminer-multi repository from GitHub and switch to the Linux branch. Next we run the build script which can take a while to complete.

If everything completed as expected, we should be left with a cpuminer binary in our cloned project. If you didn’t notice, I took the build commands from the Dockerfile found in the cloned project because it is also Linux based.

Pool Mining Altcoins with a Specific Algorithm

There are many different Altcoins in existence with more probably on the way. Instead of trying to mine one of the more mature coins like Bitcoin or Litecoin, we’re going to focus on a coin called DigiByte, also known as DGB. Feel free to adjust what comes next to meet your needs.

Mining on a Raspberry Pi is difficult, but mining solo is impossible. We need to find a mining pool for the coin we wish to mine. For DigiByte, the official list of pools can be found on the DigiHash website.

DigiHash Mining Pools for DigiByte

Take note of the algorithm you wish to use and the servers.

With an active SSH session to your Raspberry Pi, execute the following to start mining within the pool:

./cpuminer --algo qubit --url stratum+tcp://digihash.co:3012 --user D9Ms9hnm32q9nceN2b9jNshuZhWcobrmQm --pass anything

The above command uses our cpuminer-multi binary and the qubit algorithm. For the user, you’ll want to use your public DigiByte address. The D9Ms9hnm32q9nceN2b9jNshuZhWcobrmQm value is my public DigiByte address in case you wanted to donate.

Not all mining pools use the public Altcoin address as a username. Some pools require you to register, link your addresses, and use a specific username that they manage. Figure out what username and password should be used based on the mining pool documentation that you wish to use.

While the Raspberry Pi is mining, you’ll notice log output like the following:

[2017-12-20 18:12:25] Starting Stratum on stratum+tcp://digihash.co:3012
[2017-12-20 18:12:25] 3 miner threads started, using 'qubit' algorithm.
[2017-12-20 18:12:29] Stratum difficulty set to 0.01
[2017-12-20 18:12:29] qubit block 5761269, diff 190162.631
[2017-12-20 18:12:31] qubit block 5761270, diff 182120.209
[2017-12-20 18:12:31] CPU #2: 6.54 kH/s
[2017-12-20 18:12:31] CPU #1: 6.44 kH/s
[2017-12-20 18:12:31] CPU #0: 6.50 kH/s
[2017-12-20 18:12:36] qubit block 5761271, diff 172820.491
[2017-12-20 18:12:42] qubit block 5761272, diff 169053.910

This information lets us know that we’re successfully mining, but it doesn’t mean that we’ve found any coins. Occasionally, you’ll see something that looks like the following:

[2017-12-20 18:15:26] accepted: 1/1 (diff 0.116), 207.60 kH/s yes!

This does not mean that you’ve found a coin. It means that you’ve found a share in the pool. You’ll need to find quite a bit of these shares before you end up with a payout.


You just saw how to mine Altcoins on a Raspberry Pi with a CPU miner. Remember, it is unlikely that you’ll find a block with a Raspberry Pi for more established coins, but it doesn’t prevent it from being a nice learning opportunity.

Want to take this tutorial to the next level? Check out my previous tutorial titled, Mine Bitcoin and Other Cryptocurrency Coins with a CPU Miner and Docker, which focuses on Docker and pretty much any computer or operating system rather than just Raspbery Pi.

If you’re a fan of DigiByte and you wish to donate, D9Ms9hnm32q9nceN2b9jNshuZhWcobrmQm is my public address.

Nic Raboy

Nic Raboy

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in C#, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Unity. Nic writes about his development experiences related to making web and mobile development easier to understand.