Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

How to mine bitcoin with your Raspberry Pi

Save for later
  • 5 min read
  • 12 Oct 2017

article-image

Bitcoin is big - you probably know that already. Maybe you know someone who has made a bit of money by mining it on their computer. If getting started sounds like a bit of a headache and you're not sure where to start, dig out your Raspberry Pi. You might be surprised, but Raspberry Pi is a tool to use for Bitcoin mining.

Before we go further, let's make sure we understand all of the aspects involved. After all, Raspberry Pi and Bitcoin mining are quite advanced topics and not some technological terms that you read every day. So with that in mind, let's take a quick refresher course.

Okay, so let's start with the easier topic: Raspberry Pi. Basically, Raspberry Pi is a computer with a very, very small size and sold at a very, very low price. Despite the size and the price, Raspberry Pi is a full-fledged computer that you can use like any computer out there, and of course, this includes Bitcoin mining.

how-mine-bitcoin-your-raspberry-pi-img-0

How do you mine Bitcoin?


There are two ways you can mine Bitcoin. You can either use consumer-grade, general hardware like a CPU to solve calculations, or you can use hardware customized for mining Bitcoin. These are called ASIC miners. These ASIC miners can mine Bitcoin much, much more efficiently than general-purpose hardware. In fact, these days, profitable Bitcoin mining operations can only be done using those ASIC miners.

Since this post is about Bitcoin, we're going to use an ASIC miner for our mining operation. But keep in mind that there are some cryptocurrencies, like Ethereum for example, that you can't mine with an ASIC miner. Since each cryptocurrency is different, it's best to research them separately and not assume that what works with Bitcoin will also work with another cryptocurrency.

Is Raspberry Pi Bitcoin mining profitable?


The bad news is that mining Bitcoin with a Raspberry Pi isn't that profitable. As we've touched upon already, the main expense of mining Bitcoin is the cost of the electricity needed to run the hardware. This means your hardware needs to be efficient enough to earn Bitcoin that exceeds the value of your electricity costs. Unfortunately, your Raspberry Pi isn't powerful enough to deliver this sort of return.

So, why would you even want to start Raspberry Pi Bitcoin mining? Well, for one, it would make a fun side project and you'll learn a lot from doing it. And don't say it too loud, but if you have 'free' electricity (maybe you live in a dorm, for example), that could easily mean earn Bitcoin without spending much at all.

how-mine-bitcoin-your-raspberry-pi-img-1

Mining Bitcoin with Raspberry Pi


Okay, enough talk, let's actually do some mining. To mine Bitcoin with Raspberry Pi, you're going to need:

  • Raspberry Pi
  • USB Bitcoin ASIC Miner
  • Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at AU $24.99/month. Cancel anytime
  • Powered USB Hub


Having a powered USB Hub is important, because Raspberry Pi can only supply a limited amount of power to a connected USB device. Since a USB ASIC miner can draw a lot of power, using an external power source would solve the power problem. Not to mention that with a USB hub you can connect more than a single ASIC miner to the Raspberry Pi.

There are 2 more things to do before we can start mining. The first one is to set up a Bitcoin wallet, a place to store all the Bitcoin we're going to get. The other one is to join a Bitcoin mining pool. By joining a Bitcoin mining pool, you no longer need to single-handedly finish the entire Bitcoin block calculation to earn Bitcoin. Instead, you can earn Bitcoin by just solving a part of the calculation, since now you are working as a group.

All right, the next thing we want to set up is the mining software. For this one we're going to use BFGMiner, a popular mining software focused on mining with ASIC miner instead of CPU/GPU.  To install BFGMiner, you need to install a couple of additional libraries to your Raspberry Pi. You can do this by executing the following commands on the LXTerminal assuming you're using Raspbian operating system:

sudo apt-get update
sudo apt-get install autoconfautogenlibtooluthash-dev libjansson-dev libcurl4-openssl-dev libusb-dev libncurses-dev git-core –y


With the library set up, you can install BFGMiner by executing these lines:

git clone https://github.com/luke-jr/bfgminer.git
cd bfgminer
./autogen.sh
./configure
make


And now, to actually start the mining operation, connect BFGMiner with your mining pool account and run the application. It can be done by running the following command:

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


And that's it! Now your Raspberry Pi will use the ASIC miner attached to it and automatically mine Bitcoin. The field of cryptocurrency is a vast one, and this little project we've just finished is nothing but a little peek into that field. There are other cryptocurrencies, or other mining methods that you can use to gain profit more effectively.

About the author

Raka Mahesa is a game developer at Chocoarts (http://chocoarts.com/), who is interested in digital technology in general. Outside of work hours, he likes to work on his own projects, with Corridoom VR being his latest released game. Raka also regularly tweets as @legacy99.