Introduction: Bitcoin Mining Using Raspberry Pi

Picture of Bitcoin Mining Using Raspberry Pi

Want to mine some bitcoins? Want to earn for free? Have a pi not being used?

Then lets mine some bitcoins!

Step 1: What Is BitCoin?

Picture of What Is BitCoin?

If you don’t know already, Bitcoin is a virtual currency set up in 2009. Bitcoin has grown in reputation over the past few years becoming a very popular as a method to pay for services over the internet. The value has rocketed recently thanks to the huge coverage in the media, for both positive and negative reasons.

There are two ways to get Bitcoin:

-Buying them from an exchange, which is the process of converting local currency to Bitcoin.

-Mining them. Mining is the process of verifying transactions in the blockchain.

As the whole of the Bitcoin system is decentralised, every transaction is publically viewable within what is called the blockchain. This blockchain contains every bitcoin exchanged between users so, as there is no central server, it has to be self governed. This is the job of the miners.

Step 2: Requirements

In order to mine Bitcoin, you will

A pool account

Bitcoin Wallet

Raspberry Pi

Raspbian image SD card

USB Bitcoin miner

Step 3: Creating an Account

Picture of Creating an Account

There are two things you need to do:

Download a bitcoin wallet

Create a pool account

Set up paymentSet up workers

Download a Bitcoin Wallet

A wallet is a program that sits on your computer and gives you a wallet address, this is a unique string of numbers and letters that you will use to receive bitcoins. Download the client for your computer from

After installation, you will have to save a file called wallet.dat, keep this file safe, as this contains your unique wallet address within it, including all bitcoins that you will gain. If you lose this file, you cannot recover any bitcoins it contained.

Create a Pool Account Once you have a wallet address, create a pool account. A pool is a huge collection of other people working towards gaining bitcoins. Due to the complexity of mining a bitcoin, it has become unrealistic to solo mine–the act of processing millions of numbers to solve the block problem. Working as a group, or pool, lets everyone have a chance of earning some Bitcoin. There are many pools around, in this tutorial I’ll be using one called Slush’s pool:

Set Up Payment

Once you have created a pool account, you'll need to enter your unique wallet address into the Bitcoin payout address.

Create Worker Account

Next step is to create a worker login account. Within your pool account you have the ability to create something called a worker for each of your bitcoin miners, so you're able to monitor them all separately just in case one should fail.

Each worker has its own login name and password. Whilst you are on My Accountclick Register New Worker and give it a name, for example; worker, and a password. Now you're ready to set your Raspberry Pi mining for Bitcoin.

Step 4: Setting Up the Raspberry Pi

Picture of Setting Up the Raspberry Pi

Start with a fresh Raspbian install, if you don’t know who to do this, read the tutorial How to Install NOOBS on a Raspberry Pi With a Mac.

If you plan on running more than one Bitcoin miner at the same time, it is best to use a powered USB hub. Take into account the power rating as mining will need a lot of power, as much as one mp per miner.

With your USB miner attached to your Raspberry Pi, let’s get everything installed.

Step 5: Installing Required Libraries

The miner to be installed comes as source files, which means that the program must be compiled into a binary before it can be run. To make a program, in this case BFGMiner, many dependencies are required.

Dependencies are additional software, or libraries the program needs in order to compile properly, as it has been developed using them to make the software more efficient. Hopefully you will be seeing the Raspbian desktop, so double click on LXTerminaland type in the following:

1) sudo apt-get update

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

This process will take a few minutes to complete.

Step 6: Installing BFGMiner

Picture of Installing BFGMiner

Once all the dependencies have been installed, now it is time to download and install BFGMiner, so type the following into LXTerminal. It’s normal for these to take a few minutes to complete so some patience is needed.

git clone
cd bfgminer




You will be greeted with a screen that looks similar to the following:

Step 7: Start Mining Bitcoin

Picture of Start Mining Bitcoin

Now you’re ready to start mining. To do this, providing you're using Slush’s pool, you’ll use the following command:

./bfgminer -o -O username.worker:password -S all

The username section is composed of two parts, the username that you use to login to the pool, and worker which is the worker name you gave when you registered the worker. Finally, the password that was set when you created the worker.

That’s a lot of numbers, so I’ll make some of them a bit clearer.
Current mining speed, typically calculated in megahashes or gigahashes. The number of hashes a second that can be calculated the better. A hash is an algorithm of converting numbers and letters into an undecryptable set of characters. So a miner is used to process millions of numbers in an effort to match the hash to guess the original number. The more hashes that can be processed the faster it is able to solve the problem.

Number of accepted shares. A share on a pool is to show the miner has successfully worked out a given problem, so the more shares you can process the better your reward from the pool.

Detailed information on accepted shares and pool updates. This is a running log of what is currently happening with the miners and basic pool information, such as messages of updates and when new blocks are found.

More information can be found at the BFGminer github site.

Step 8: Conclusion

Picture of Conclusion

Following these steps will leave you with a very energy efficient bitcoin miner, as a Raspberry Pi only uses four watts of power, and a miner is typically 2.5W. Mining used to be done with computers consuming over 700W for the same process so to make a jump in savings helps repay the cost of the hardware we are using.

All there is to do now is to sit back and watch the money slowly build up. Though it is important that you understand that Bitcoin value fluctuates wildly, it is extremely volatile, so invest at your own risk.

You can also put up LCDs. Connect more Pis for getting better speed :D

For more information there are a number of websites and forums available, such as,to help get you started.


НетуН (author)2018-01-18


Eight rapesberry will cost more than $ 400!

Plus the complexity of bitcoin is huge!

They will consume more electricity than the income will be.

10 gigacheesh will bring in a month 40 cents!

PeterH377 (author)2018-01-15

Is this still viable in 2018?

br0x (author)2015-04-21

You must mention in your article that mining is not profitable anymore, unless you have free electricity (that is stealing it), but in that case stealing money should be considered as more effective solution :)

EsaE (author)br0x2015-04-22

I have free electricity and I'm not stealing it. It's included in my rent :)

antioch (author)EsaE2015-04-22

I get electricity from the sun. Filthy electricity thief, that I am. Sorry, sun!

ChristinaB46 (author)antioch2018-01-12

thats what I was thinking when "free" was mentioned. Solar or wind powered.

caprirolo (author)EsaE2015-04-29

Well, it's not really free. That cost is included in your rent.

JohnQ33 (author)caprirolo2017-12-08

In a way, but most of the time when it is included in your rent you can use however much you want and your rent stays the same. A lot of places do the same with water. no matter if you use 1 kW per day or 80 the price stays same.

JCS725 (author)2017-09-15

I realize this isn't going to be a big money maker or a money maker at all but I also ran into problems with the Make command I get the following

pi@raspberrypi:~/bfgminer $ make

make: *** No targets specified and no makefile found. Stop.

pi@raspberrypi:~/bfgminer $

Does anyone have a recommendation? I'd like to get this up and working just to learn more about it.

JCS725 (author)JCS7252017-09-15

For those that were stuck after running the make command do this first..
sudo apt-get install libevent-dev
then run ./configure and make.
You should be good after that.

MaxM213 (author)JCS7252018-01-11

It worked! thanks

geert95 (author)JCS7252017-11-04

Thank you

KeithM9 (author)JCS7252017-09-25

So I noticed that after trying your tip, it still does not work. I then ran:

sudo apt-get update --fix-missing



...and now all is good. BTW, I know Raspbian Wheezy has long been dead after the arrival of Jessie (also dead) and Stretch, but my Bitcoin mining seems more stable with Wheezy (the 2015-05-05 version).

Andrew9022 (author)2018-01-03

I got to the last step and when I put in the final line of code I get

bash: ./bfgminer: Is a directory

Any suggestions?

mwasson11 (author)2017-11-27

okay i have do everything up to ./bfgminer -o -O username.worker:password -S all.

when i run that everything works but it says that there is no devices found. what am i supposed to do as the creation of a device is not very descriptive?

roujesky (author)2017-11-19

i get:

pi@raspberrypi3:~/bfgminer $ ./
Getting submodules...
Running autoreconf -if...
./ 24: ./ autoreconf: not found
pi@raspberrypi3:~/bfgminer $ ./configure
bash: ./configure: No such file or directory
pi@raspberrypi3:~/bfgminer $ make
make: *** No targets specified and no makefile found. Stop.
pi@raspberrypi3:~/bfgminer $

anybody have any ideas?

matt.rasico (author)2017-11-17

I keep getting a bash: ./configure: no such file or directory

Any ideas?

JensA7 (author)2017-10-28


Am just trying to get into this at the moment. I have two GekkoScience USB Miner, works well except that one is all time inactive in cgminer, although I can see it online there. Any suggestions?

roro33112 (author)2017-08-15

bonjour je suis bloger sur la config pour miner ki peux me donne la bonne config merci

abhuk-arbhuk (author)2017-07-10

How many satoshi you can get for 24 hours?

vrd (author)2017-06-03

is the latest noobs worked with raspberry pi model B ?

i cant boot it up the latest version with the sd card.


atrepanier (author)2017-06-02

might try this.

swalters10 (author)2017-03-14

did not work for me, got to the part where you make and was not recognised.

diy_bloke (author)2015-04-21

interesting article.
I was just wondering, with an average usb miner costing say 50 USD and an Rpi say 40 USD, did you already break even?
I really have no idea how long it would take to mine a bitcoin r wether that is even a predictable time

creepy0000 (author)diy_bloke2016-12-27

from what I've read it should take 70 years to break even

creepy0000 (author)2016-12-27

What usb bitcoin miner did you use?

BenManning (author)2016-11-28

Can you do this project without a USB block erupter/miner?

LeeW22 (author)2016-09-28

Everything went smooth until the make command then I got "No targets specified and no makefile found"

how much BTC would i make with four RPIs - model 1 1st model??

you can't mine bitcoin with the raspberry pi, the pi is only used to host the miners so they don't need to be tethered to a computer

alirezaj3 (author)2016-07-01

autoreconf pakage required

calebv4 (author)2016-02-03

What USB miners would anyone suggest? Something cheap; I'm not trying to support myself on this or anything

StevenN41 (author)calebv42016-05-07

Nitr0 (author)2015-12-28

Any idea how I could add a PC CPU to the raspberry pi?

Cursed Number (author)Nitr02016-01-12

Just lop off the Broadcom unit and slab on an i7-6700k with some superglue! Probably won't run any faster but it will look ultra cool. :)

dianadfonseca (author)2015-11-08

Thanks for sharing this! Maybe your next instructable could be how to make this profitable ;)

Noambz1 (author)2015-09-15

How much sd cards and usb miners do I need for every Pi? There are four usb`s in the picture, but I don`t sure if I can get enough.

xxdevinhalxx (author)2015-04-21

Link to the acrylic enclosure you used to house the eight Raspberry Pis?

DevinB5 (author)xxdevinhalxx2015-08-16

occam999 (author)2015-04-21

To see how much you can make on mining check out - at the moment you can generate about 10 US cents worth of bitcoins per month with 1.3Gh/s as shown on the display on the picture in the article.

Jovar (author)occam9992015-04-24

Hah. At SDG&E current average electricity costs ($.21 per kwH) it would cost about $.21 per kwH (assuming 6.5 watts usage 24 hours per day), so you'd be losing 11 cents per month. Break-even is somewhere around 14 to 15 cents per kwH (assuming the 10 US cents per month earnings is correct).

Honchkrow (author)Jovar2015-06-01

how about using solar power...

ianmcmill (author)occam9992015-04-22

You will most likely find more money on the streets. By far more money if you don't invest in high end mining equipment.

luposays (author)2015-05-11

can this setup process work to mine scrypt coins like lite and doge assuming you bought the scrypt asic hardware? I know people are doing it but no one has the same miner for scrypt it seems

bassbindevil (author)2015-04-29

It would be cost-effective if you live someplace where electricity is used for heating. At least in the winter, or perhaps for some commercial processes.

thault (author)2015-04-23

I think this is a great little thing to do. While you will never make money off of it; it's cool just to say you were a part of it. Conversation starter with your nerdy friends. I've got some coming in; if you want you could become a part of a multipool which will focus on whatever digital currency that is most profitable.

mhartnett (author)2015-04-20

What sort of money per day/week are you looking at so far?

bobsmith652 (author)mhartnett2015-04-21

$0.02 per month per USB device. Unless you get free electricity, you will be making a loss.

bratan (author)bobsmith6522015-04-22

Even with free electricity you'll need about 84 YEARS to make up the cost (if my math is correct) of USB miners. Each USB miner costs $24. According to current difficulty to make $1 a month, you'll need 43 miners, that's a $1000. I'm not even counting cost of RPis here.

emerson.john (author)2015-04-21

I am curious, too, what the unit "mp" means. Although you say it's a unit of power, did you mean unit of current, and mean to say "as much as 1 Amp"?

About This Instructable




More by ssarthak598:DIY Smart Home Monitoring BottleArduino Video Game (The DIY Gift)Is My Fridge Door Open?!
Add instructable to: