Author: Darhan Saami
Bitcoin has been a source of fascination for people all over the world. Prices of Bitcoin have been on an incline for some time now. This incline has mostly been a general trend for almost all cryptocurrencies. Trading at more than 48000 USD as of February 2021, Bitcoin is by far one of the more popular cryptocurrencies in the world. Since Bitcoin offers excellent returns, and Raspberry Pi is a very affordable gadget, we will evaluate whether mining Bitcoin or other cryptocurrencies using Raspberry Pi is worth it?
What is cryptocurrency mining?
In simple terms, cryptocurrency mining is the process that uses computers to solve cryptographic equations. This process ultimately helps us obtain cryptocurrencies. These complex cryptographic functions are solved, and then their record is processed and saved in a public ledger known as the blockchain. Furthermore, mining also depends a lot on luck. Therefore, the more powerful your computer is, the greater your chance of mining cryptocurrencies at greater efficiency.
Bitcoin uses the same method for its mining process. Although it is trendy, it is not the only frenzy cryptocurrency out there. Many users recommend alternate cryptocurrencies for compatibility with Raspberry Pi.
What you require to set up crypto mining on Raspberry Pi
To start mining cryptocurrencies on your Raspberry Pi, you will require some additional accessories while setting up. In the following lines, we will give a short overview of the accessories you might need:
- Raspberry Pi 3 or 4, preferably.
- SD card running Raspbian compatible with network access.
- Any screen and keypad kit compatible with your Raspberry Pi. We recommend Adafruit 16×2 LCD.
- An I2C device.
- You will also have to install Adafruit Pi code libraries on your Raspberry Pi before commencing the mining process.
- A USB Bitcoin mining device. However, you do not need to mine Bitcoin only.
- A powered USB hub. You will need it for USB-powered mining devices. Typically, a USB power hub can power up to 4 mining devices.
- A Bitcoin wallet.
- A mining pool account.
How to set up for Bitcoin mining using Raspberry Pi
The first thing you will need to do to get going is to download a Bitcoin wallet. It is a computer program that gives you a unique wallet address. This address is a unique string of letters and numbers which will receive and store Bitcoins. You can download this program from the following link:
Once downloaded, you will have to complete the installation setup before you can run the program. Once that is done, you will have to save a file called wallet.dat onto your computer. This file is your Bitcoin wallet. It is crucial to keep it safe, as losing it means you will also lose all your Bitcoins along with the file.
Once you have your wallet, the next step is to create a mining pool account. The pool serves as a platform to allow multiple people to mine collectively. Since Bitcoin algorithms are very complex, larger groups of people can mine at a greater efficiency than a single device mining all by itself. There are plenty of mining pools around, and you can use any one of them. The pool I used to mine my Bitcoin is called Slush’s Pool.
Once you have created a mining pool account, it will ask you for your unique wallet address or a Bitcoin payout address to store your Bitcoin. Having provided, all you need to do is create one or multiple worker accounts on the mining pool. A worker has unique login credentials. You could even create more than one worker in case some of them fail at mining your cryptocurrency. A worker can be created by going to ‘My Account’ and then clicking on ‘Register New Worker’ and giving it a name.
Now you are ready to set up your Raspberry Pi device.
How to set up the Raspberry Pi
The operating system used by Raspberry Pi is called the Raspbian. We recommend you use a fresh Raspbian installation before commencing the mining process. It is reasonably easy to install the Raspbian. If you are unsure about installing it, you can check our other blog or run a Google search about a guide on how to install NOOBS on a Raspberry Pi using Mac or Windows.
It is important to note that cryptocurrency mining consumes lots of units of power. Therefore it is recommended that you use a powered USB hub during this process. Bitcoin needs excessive and stable power input, so you could also mine alternate cryptocurrencies that require lesser units of power, perhaps.
Now that you have attached a powered USB hub to your Raspberry Pi, the next step is to install the required libraries for Bitcoin mining. For this, you will need to do some coding too. The miner that you are to install is a source file. You will have to convert it into binary before you can install it. Furthermore, there are other libraries and dependencies that you need to install before you start mining. Up next, we will provide you with steps that you can follow to install what you need.
Go to your Raspbian desktop and double-click on LCTerminaland.
Type in the following pieces of code on the program:
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
These codes will take a few minutes to compile. Do not worry if your screen gets spammed with lines of code that you cannot understand. It is also normal for this process to take a while, so do not fret. The above lines of code serve the purpose of installing dependencies on your Raspberry Pi. Once this process gets completed, you want to download the BFGMiner. You can download the BFGMiner by typing in the following set of commands:
git clone https://github.com/luke-jr/bfgminer.git cd bfgminer ./autogen.sh ./configure make
Again, you will have to wait for a while until this code gets compiled. The screen in front of you will get clustered yet again. However, now you are almost done, and you can start mining. Provided that you have used the same mining pool as me, Slush’s Pool, you can type in the following commands to start mining:
./bfgminer -o stratum.bitcoin.cz:3333 -O username.worker:password -S all
Congratulations! You have successfully started mining Bitcoin on your Raspberry Pi. Information on the screen is not necessarily easy to comprehend, so we will give you a list of things you may look out for.
- Current mining speed: this gives you the speed at which you are currently mining. The rule of thumb is that the more your speed, the merrier it is.
- Number of accepted shares: This shows the number of shares accepted by your miner in the pool. A larger number of shares means a better payoff.
You are now mining Bitcoin in a very power-efficient way. Raspberry Pi typically consumes 4 Watts of power compared to regular miners, which have power ratings above 700W. While there are advantages associated with Raspberry Pi’s power efficiency, they are far outweighed monetarily by traditional miners that can mine significantly higher rates earning more quantifiable profits. You can connect more Raspberry Pi’s to increase the speed of mining.
How profitable is mining on Raspberry Pi?
At this point, we must consider the trade-offs of mining Bitcoin using a Raspberry Pi. Raspberry Pi is not a suitable device to mine cryptocurrencies if you want to earn profits because of its lower power consumption, which eventually translates into less Bitcoin mined. Typically, even 24 hours of mining using a Raspberry Pi would likely earn you Bitcoin equivalent to less than 1 penny, despite its astronomical exchange rates. Therefore, we do not see much of a commercial value in using Raspberry Pi to mine Bitcoin. However, it is an excellent and affordable choice set up to mine for other purposes. These purposes could entail learning or teaching others how to mine cryptocurrencies. You could also experiment around with various other cryptocurrencies to get a greater grasp of mining. All of this could come in handy before you decide to invest in regular miners that are far more expensive and contribute to excessive and unpleasant noise.
This experiment is an excellent example of the sheer number of things one could do with a Raspberry Pi. While mining Bitcoin on a Raspberry initially sounds like a very cool thing to do, I found this an unnecessary utility of the Raspberry Pi. Apart from education-related uses, it does not offer great commercial benefits. We will not recommend you invest in a Raspberry Pi just for the sake of mining some cryptocurrencies. Despite Bitcoin’s astronomical exchange rates, it might take you a long time only to break your costs of setting up this system even. There are an incredible number of things you could do on a Raspberry Pi. We recommend you put it to a better purpose.
If you’d like to try this, you can get a Raspberry Pi here.
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.