How to mine cryptocoins with a Raspberry Pi 3

Last Updated on

Is it really possibile?

Many people ask themselves if t is possible to use their small Raspberry to earn money in general. With criptocurrencies spreading all over the world, mining has become really popular and easy to access also with a very simple PC. But, honestly, if you are expecting to generate an income by mining criptocurrencies, I must advise you that this is really hard. However, I will explain a step-by-step guide to make possible mining in our Raspberry.

What we need

As usual, I suggest adding from now to your favourite ecommerce shopping chart all needed hardware, so that at the end you will be able to evaluate overall costs and decide if continuing with the project or removing them from shopping chart. So, hardware will be only:

I strongly suggest to evaluate buying a case with cooling system with fans (for example give a try searching Raspberry PI Case with cooling on Amazon).

I will configure my raspberry by ssh connection from my PC with Putty.

I will also use as mining software “cpuminer-multi”. This is a multi-threaded CPU miner, fork of pooler’s cpuminer and supports a wide number of algorithms.

Configuration

login.jpg

We suppose to start from a configuration of Raspberry 3 model B with Raspbian Stretch Lite. You can achieve it by following my guide in Installing Raspbian Stretch Lite in your Raspberry Pi 3 model B.

Let’s connect to our Raspberry. Install all dependencies:

sudo apt-get install automake autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl1.0-dev libgmp-dev make g++ git

and confirm installation. Clone git repository where cpuminer-multi is hosted:

git clone https://github.com/tpruvot/cpuminer-multi

enter the new folder created:

cd cpuminer-multi/

Compile with following 3 commands:

./autogen.sh
./configure --disable-assembly CFLAGS="-Ofast -march=native" --with-crypto --with-curl
make

Last command will take some minutes.

Now you are ready to start mining, but you must choos a mining pool. Please check Solo mining versus pool mining to see differences between solo mining and pool mining. Then you can try your miner installation registering in a mining pool and connecting to it. For example, I usually use Minergate, and this is how to start mining.

Choose your coin to be mined: in the following example I will mine Bytecoin (be aware, it is different from most famous BitCoin and better suitable for low performance hardware). So, next command will be the following:

./cpuminer -a cryptonight -o stratum+tcp://bcn.pool.minergate.com:45550 -u <<YourMinergateMail>> -p <<YourMinergatePassword>> -t 3

where you have to edit:

  • <<YourMinergateMail>> with mail address used to register in Minergate
  • <<YourMinergatePassword>> with password set during Minergate registration

last option, “-t 3” set the maximum number of cores usable. I strongly suggest not to use all cores because of temperature growth that could lead to hardware failures. Take a continuous look on system temp with the following command:

watch cat /sys/class/thermal/thermal_zone0/temp

which gives you a continuous look to system temperature (divide resulting number by 1000 and you have temperature in °C).

Enjoy!