Raspberry Pi Mining: Bitcoin & Altcoin Mining (without buying a USB miner)
Many Cryptocurrencies like Bitcoin and Ethereum now have a such a high difficulty that you can only mine them with a rack of dedicated graphics cards. However there are still some coins like Monero and Bytecoin that you can use a CPU for mining. Monero/Bytecoin are based on a different algorithm than bitcoin which makes ASIC’s useless for the cryptonight mining. Here is the list of coins that can be mined by CPUs.
Monero mining is more efficient on GPU but it’s technically possible to do it on a Pi. But there are some other caveats. The Pi has a 32 bit processor and the CPU miner is designed 64 bit only, so you will have to recompile it. And regarding efficiency, the CPU miner profits from large CPU caches, which are not present on the Pi board, another efficiency reduction.
First off, let’s see what kind of coins we can mine with Raspberry Pi. Due to its physical limitation, we have to exclude all the GPU mining coins because the GPU on Pi is not compatible with all of the mining programs and no one creates a mining program for Raspberry Pi. This narrows down our choices. We want some coins that allow our Pi to mine with its CPU processors (We got 4 in this little beast). Let’s choose Bytecoin (BCN) & Monero (XMR)! Because both of them are using CryptoNight as its POW algorithm.
Info from Bitcoin wiki:
CryptoNight is the proof-of-work algorithm used in CryptoNote and Bytecoin (BCN). It is designed to be egalitarian, being suitable for ordinary PC CPUs, but not the special purpose devices for mining. Therefore, the currencies based on CryptoNight are CPU-mined only.
Mining with your Raspberry Pi
OK! Now we got the Pi up and running, we have the coins’ name we would like to mine. Now we need a script to run. But before that, we need to install all the required dependencies. And also install the CPUminer on our Pi.
Let’s go to the Pi terminal and type these commands in one by one.
(lines with # in front are explanation for the next line, no need to type into the terminal )
# update raspbian sudo apt-get update -y # install the following dependent modules sudo apt-get install autoconf libcurl4-openssl-dev libjansson-dev openssl libssl-dev gcc gawk # clone this miner repo git clone https://github.com/lucasjones/cpuminer-multi.git # navigate to the directory and compile cd cpuminer-multi ./autogen.sh ./configure make # to see instructions on how to use the CPUminer: ./minerd --help
After everything is correctly installed the next step is to put in the command to start the mining process.
To mine XMR, use this command |
./minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u firstname.lastname@example.org -p x -t 4
To mine BCN, use this command |
./minerd -a cryptonight -o stratum+tcp://bcn.pool.minergate.com:45550 -u email@example.com -p x -t 4
Note: You will also need to register a MinerGate account and use that email you registered with and replace firstname.lastname@example.org.
-a cryptonight : This is the crypto type
-o stratum+tcp://xmr.pool.minergate.com:45560 : This is the pool and port number
-u email@example.com : Pool username
-p x : Pool password
-t 4 : Number of threads (4 because the RPi 3 is a 4 core processor)
Despite its amazing specs as a tiny board, you still won’t make a single coin even while running it 24×7 for a couple of months because the hash rate is low as hell. This tutorial is purely for educational purposes and not geared towards making money using cryptocurrency mining with Raspberry Pi!