Cryptocurrency is incredibly popular, from Bitcoin to Litecoin, Ethereum, and Monero. These digital assets are digital, decentralized currencies. There are two main methods for obtaining cryptocurrency: mining and purchasing. Learn all about cryptocurrency mining on the Raspberry Pi!

Cryptocurrency Mining on the Raspberry Pi: Before You Get Started

Before plunging into mining cryptocurrency on the Raspberry Pi, there are several considerations. First, approach the project as a means of learning more about cryptocurrency and a neat do-it-yourself (DIY) endeavor. While the Raspberry Pi is a capable, low-power consumption device, it’s not ideal for cryptocurrency mining. In its infancy, crypto mining such as mining Bitcoin, on a home computer proved profitable. Now, GPUs are best suited for mining, and the best rigs for mining cryptocurrency like Ethereum or Bitcoin feature beefy GPUs that outstrip Raspberry Pi hardware. Nevertheless, even phones can mine cryptocurrency, such as the Sugar S11 Blockchain Creation Edition. As such, a Raspberry Pi can totally serve as an inexpensive crypto miner.

However, the distinction is that the Raspberry Pi can mine, but doesn’t necessarily do so profitably. Mostly, this depends on the specific cryptocurrency, what it’s valued at and how much the Pi can generate each day. Though the Raspberry Pi doesn’t pack a ton of computing power, it’s incredibly energy efficient and there’s a low startup cost. Plus, it’s simple to get set up, and an intuitive method for learning more about cryptocurrency, as well as Raspberry Pi software and hardware.

Pros:

Energy-efficient hardware

Decent computing power

Low start-up cost

Easy to set up

Cons:

Not profitable

Picking Your Currency - Which Cryptocurrency is Easiest to Mine on the Raspberry Pi?

The first step in cryptocurrency mining on a Raspberry Pi is selecting your preferred currency. Because the Raspberry Pi can’t stack up against ASIC devices or GPUs, it’s best to pick a coin that’s CPU-mineable. If you seek a profit, for cryptocurrency mining on a Raspberry Pi, look to alternate coins. Novaspirit reports solid performance with Magicoin mining on a Pi. Although, it’s been about a coin a day, which is somewhere from $0.20-0.25 USD. That’s not terrible, especially considering that once you begin filling your digital wallet, it will stake, the wallet will earn interest and generate coins for you. Plus, Magi uses proof-of-state.

Storj is another option that can be mined on a Raspberry Pi. Since Storj relies on storage, rather than paying cloud providers for file storage, it makes the low-power Pi a viable piece of hardware. You may also consider using ASIC miners plugged into the Raspberry Pi for obtaining cryptocurrency such as Bitcoin.

Magi

Storj

Bitcoin

Monero

Bytecoin

Choose Your Hardware

Next, pick your Raspberry Pi hardware. As the Pi is low-powered and low-priced, I recommend sticking with a Raspberry Pi 4. That affords the best computing power. The board itself retails for $35, but you can snag a kit with power supply and heatsink for $50 or more.

Cost: $35+ USD

Bitcoin Mining With a Raspberry Pi - Raspberry Pi Bitcoin Mining

You can easily mine Bitcoin on the Raspberry Pi. For this, you’ll need the Pi, a Raspbian image, pool account, Bitcoin wallet, and USB bitcoin miner.

Raspberry Pi (RasPi 4 recommended)

Bitcoin wallet

Pool account

Raspbian installed

USB Bitcoin miner ($20-$400 USD)

Total cost: $55-$460 USD

For this method, you’ll need to begin by creating a pool account and download a Bitcoin wallet. You can snag the Bitcoin client here. Once you’ve installed your wallet, create a pool. Essentially, a pool is a conglomeration of other miners who collaborate toward obtaining Bitcoin. Solo mining simply isn’t profitable.

After creating your wallet and a pool, configure payment by entering your wallet address. Then, set up a worker account for each one of your Bitcoin miners. If you have one ASIC Bitcoin miner, you’ll need one worker account. For two USB miners, you’ll need two accounts, and so on.

To set up the Pi, install the proper libraries:

sudo apt-get update

sudo apt-get install autoconf autogen libtool uthash-dev libjansson-dev libcurl4-openssl-dev libusb-dev libncurses-dev git-core –y

Then, install BFGMiner:

git clone https://github.com/luke-jr/bfgminer.git

cd bfgminer

./autogen.sh

./configure

make

Finally, begin mining! You’ll simply enter the proper commands, detailed on the BFGMiner GitHub Readme.

Single pool mining:

bfgminer -o http://pool:port -u username -p password

Multi-pool mining:

bfgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password

Multi-blockchain mining:

bfgminer -o http://pool1:port -u pool1username -p pool1password --pool-goal default -o http://pool2:port -u pool2usernmae -p pool2password --pool-goal freicoin

Single pool standard http proxy mining:

bfgminer -o http://pool:port -x http://proxy:port -u username -p password

Single pool socks5 proxy mining:

bfgminer -o http://pool:port -x socks5://proxy:port -u username -p password

Bytecoin and Monero Mining With a Raspberry Pi

You can easily get started with Monero and Bytecoin mining. These are CPU-mined and feature proof-of-work.

Raspberry Pi ($35-60 USD)

Raspbian

CPUminer software

MinerGate account

Total Cost: $35-60 USD

Begin by registering with MinerGate. With Raspbian installed, install the dependencies:

sudo apt-get install autoconf libcurl4-openssl-dev libjansson-dev openssl libssl-dev gcc gawk

Then, clone the miner repository:

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

When that’s finished, navigate into the CPUminer directory and compile the program:

cd cpuminer-multi

./autogen.sh

./configure

make

That’s it! You’re ready to start mining. Run the following help command to view instructions for using CPUminer:

./minerd --help

To start mining Monero, run:

./minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u youremail@address.com -p x -t 4

For Bytecoin mining, run:

./minerd -a cryptonight -o stratum+tcp://bcn.pool.minergate.com:45550 -u youremail@address.com -p x -t 4

Magi Mining With a Raspberry Pi

Since it’s an alt-coin, features POS, and is CPU-mineable, Magi is another superb option for cryptocurrency mining on a Raspberry Pi.

Raspberry Pi ($35-60 USD)

Raspbian

CPUminer

Magicoin wallet

Total Cost: $35-60 USD

Like Bytecoin and Monero mining, this is a low-cost option that only requires a Pi. We’ll use Novaspirit’s CPUminer.

With Rapsbian installed, compile the CPUminer software and its dependencies:

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

Next, clone the source code from GitHub:

git clone https://github.com/novaspirit/wolf-m7m-cpuminer

Now, generate the required files for compiling the miner:

cd wolf-m7m-cpuminer

./autogen.sh

You’ll need to use compiler flags:

CFLAG="-O2 mfpu=neon-vfpv4" ./configure

Then, modify the makefiles to switch -march=native to -mcpu=acortex-a53 . These are located at:

nano Makefile

and

naon m7/MakeFile

Once that’s complete, compile the software using the make command:

make -j4

With that accomplished, direct the software to a pool:

./minerd -a m7mhash -o urlofpool:8080 -u worker.1 -p password

Storj Mining With a Raspberry Pi

Since it includes proof-of-retrievability, Storj is another fantastic cryptocurrency mining with a Raspberry Pi choice. David Egts reports earning about $16 from 50 GB farmed from a Raspberry Pi.

Raspberry Pi ($35-60 USD)

Raspbian

Storj software

Download Node Version Manager:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.3/install.sh | bash

Then, in a new terminal, install the NVM Long Term Service (LTS) variant:

nvm install --lts

With that complete, perform an update:

sudo apt-get update && sudo apt-get dist-upgrade

Then, install Python:

sudo apt-get install git python build-essential -y

After all of this, your Storj dependencies should be installed. To install Storj Share, enter:

npm install --global storjshare-daemon

Now, create a Storj Share node:

storjshare create --storj=YOUR_STORJ_TOKEN_WALLET_ADRESS --storage=/mnt/storjmerge/storj.io/

Finally, create a script to make Storj start everything simultaneously:

storjshare daemon

storjshare start --config /path/to/storjconfig/xxxx.json

If you like, you may configure Storj Share to start at boot. First, open a command prompt and run:

env > ~/.env

Next, create a watchdog script in the home directory:

nano ~/watchdog.sh

In the watchdog.sh, add these lines:

#!/bin/bash

. $HOME/.bashrc

. $HOME/.profile

. $HOME/.env

APP=$(ps aux | grep -v grep | grep storjshare)

if [ -z "$APP" ];

then

echo "Restart storjshare-daemon"

storjshare daemon

fi

APP=$(ps aux | grep -v grep | grep 'farmer.js --config')

if [ -z "$APP" ];

then

echo "Restart farmers"

storjshare start --config $HOME/.config/storjshare/configs/1f100594a6c1830b3d135f537575dea05f41cbf1.json

fi

Make this executable with:

chmod +x ~/watchdog.sh

And create a Cron job using:

crontab -e

by these lines:

*/5 * * * * $HOME/watchdog.sh

@reboot $HOME/watchdog.sh

Cryptocurrency Mining on the Raspberry Pi: Final Thoughts

Although cryptocurrency mining on the Raspberry Pi might not be hugely profitable, it’s not an entirely expensive endeavor. Thus, it’s the perfect project to learn more about cryptocurrencies, from how they are mined to which coins exist. Notably, it’s a great means to explore alt-coins like Bytecoin and Magi. Plus, mining crypto coins on a Pi is another opportunity to probe Raspberry Pi hardware and software.

By beginning cryptocurrency mining, even purely for fun, not for a substantial profit, you’re more invested in the crypto-coin space. Moreover, opting for a Bitcoin alternative such as Magi does reap some return, albeit a small one.



Did you know that you can turn your Raspberry Pi into a cryptocurrency wallet? Check out our latest tutorial!

Your turn: Have you tried using a Raspberry Pi as a cryptocurrency miner? Which currencies do you recommend?