Official website for Linux User & Developer
FOLLOW US ON:
Jul
27

Mine Bitcoins with Raspberry Pi

Posted by Rob Zwetsloot

Jump on the cryptocurrency bandwagon and mine some of your own Bitcoins – or other currency – with a spare Raspberry Pi

The concept of cryptocurrencies has come about in recent years as a sort of reaction to the way standard currencies are controlled. Cryptocurrenices such as Bitcoin are decentralised and not controlled by any one entity. In the past couple of years, Bitcoin has taken off to become a very valuable commodity, with whole Bitcoins becoming worth hundreds of pounds. While you can trade your standard currency for a Bitcoin, you can also mine them with a working computer.

The concept of mining basically means that you’re increasing the security of the Bitcoin system by logging transactions properly; users who donate processing power to this endeavour get paid for it in Bitcoins. This is where we come in, turning your Raspberry Pi into a Bitcoin mine.

Create your own Raspberry Pi Bitcoin miner
Create your own Raspberry Pi Bitcoin miner

What you’ll need

cpuminer
Bitcoin pool

Step-by-step

Step 01 Install dependencies

In this tutorial we’re going to be using cpuminer to mine for Bitcoins; this needs to be compiled from source though, so we have to install some dependencies first to make sure it works. Do this with:

$ sudo apt-get install gcc gcc-4.5 g++ g++-4.5 libstdc++6-4.5-dev libpcre3-dev libcurl3-dev make less

Step 02 Download locations

In order to make the building we’ll be doing soon a little bit easier, it’s best to create a directory for our files now. Still in the terminal, use:

mkdir bitcoind

After you’ve done that, move to the new directory with

cd bitcoind

Step 03 Get cpuminer

Visit the SourceForge link for cpuminer and download the latest version of the source from there to this new directory. It will be the latest version with no OS attached to the title. At the time of writing this is pooler-cpuminer-2.3.3.tar.gz.

Step 04 Extract the files

If you’re in the desktop you can easily extract the files from the file manager. Otherwise go back to the terminal you’ve been working in and unpack it with:

$ tar -zxvf cpuminer-1.0.2.tar.gz

Follow up by moving into the new cpuminer folder with cd.

Step 05 Build cpuminer

To build cpuminer we’ll be using two very standard compiling commands: ./configure and make. Both may take a while, with the make command likely to take the longest time. If you’ve followed the preceding steps properly, compiling should not be an issue for you.

Step 06 Join a pool

Mining solo is generally considered a futile effort if you want to actually make Bitcoin out of the process. Joining a pool is the best way to do this and be involved with the community at the same time. Sign up to get a username, password and URL.

Step 07 Start mining

With your worker details secure, go back to your Raspberry Pi and cd to the cpuminer folder again. To begin with cpu mining, enter the following command:

$ ./minerd --url [pool address] --userpass [username]:[password]

Cpuminer will then show your hashrate as it goes, which will probably be a touch slow at this stage.

Step 08 Increase mining speed

If you want to try and get a few more hashes per second from your Pi, you can always overclock it. In the terminal, open raspi-config and find the overclock option. You can increase it to whatever speed you wish but be aware that overclocking may seriously reduce your Pi’s lifespan.

Step 09 Future prospects

You’re unlikely to make much out of a Raspberry Pi this way; if you want to make a serious amount of Bitcoins you’ll need to increase your hashrate. You can expand your operation by attaching USB Bitcoin miners to the Raspberry Pi and powering it up exponentially.

  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • TechGuy

      It’s only for fun – these days the ‘difficulty’ level has increased so much that you’ll spend more in electricity running even a raspberry pi than you’ll get back from mining.