Introduction: Bitcoin Mining on Your Raspberry Pi
Bitcoin is a cryptocurrency, a form of electronic cash. It is a decentralized digital currency without a central bank or single administrator that can be sent from user to user via the bitcoin network.
There are two main methods for obtaining bitcoin: mining and purchasing. In this tutorial we will focus on cryptocurrency mining on the Raspberry Pi!
For your bitcoin miner you need the following equipment:
Step 1: Construction
Step 2: Check for Updates
Type in this command to check for updates:
sudo apt-get update
You might have to upgrade your operating system too, if its a older version:
sudo apt-get upgrade
Step 3: Create a Bitcoin Wallet
To receive your mined bitcoins, you need a wallet to save them. The two general types of Bitcoin wallets are online and offline.
An online wallet requires internet connection. You have to enter your username and password to access your wallet from any device and you don't have to worry about its backup and maintenance.
Offline wallets store your bitcoins on a computer, so they do not require an internet connection. Such wallets require a lot of space on your hard drive and you are fully responsible to your wallet. It is recommended to make backups weekly and save it on multiple devices. If you loose your wallet, because your computer is broken and you have no backup, then all your bitcoins are gone.
How to create an online Bitcoin Wallet?
- Go to coin.space
- Click on 'Create new wallet'
- Click on 'Generate passphrase'
- Save the passphrase somewhere, where you will find it again and make several backups of this passphrase
- You have to agree, that you have written down or otherwise securely stored your passphrase and you have to agree to the terms & conditions to continue.
- Click on 'Set your PIN'
- Set a PIN for quick access
You have now successfully created a bitcoin wallet!
Step 4: Enter a Mining Pool
A mining pool is the pooling of resources by miners, who share their processing power over a network, to split the reward equally, according to the amount of work they contributed to the probability of finding a block.
How to enter a mining pool?
- Sign up to Slushpool
- Open the profile settings (click the user icon on the top right corner > click on 'Settings')
- Click on the 'Bitcoin' tab
- Click on 'BTC Payouts'
- Add your wallet address (on Coin Space, the address can be found by clicking on receive)
You are now part of a mining pool!
You can create workers by clicking on the workers tab and 'new worker'. 'worker1' is already created during the registration process.
Step 5: Install the Miner
The miner is responsible for the actual mining part. It uses the power of the USB Miner and searches for blocks. In this tutorial we use cgminer, a multi-threaded multi-pool miner for bitcoin.
- Install the dependencies
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev screen libtool automake pkg-config libjansson-dev screen
- Clone the cgminer repository from github
git clone https://github.com/bitmaintech/cgminer
- Install and configure the miner
sudo ./configure --enable-bmsc
- Start the miner
sudo ./cgminer --bmsc-options 115200:0.57 -o POOL -u USERNAME -p PASSWORD --bmsc-voltage 0800 --bmsc-freq 1286
POOL: the url to the pool. Default: stratum+tcp://stratum.slushpool.com:3333
USERNAME: [your_slushpool_username].[your_worker] Default: yourusername.worker1
PASSWORD: anything, you don't need to enter your login password
For more information about available pools on slushpool click here.
I highly recommend using a cooling case for your Raspberry Pi, to avoid overheating.
Step 6: Automatically Start the Miner on Boot (optional)
- Edit the 'rc.local' file
sudo nano /etc/rc.local
- Just above 'exit 0' add the following lines with your slushpool credentials
screen -dmS cgminer ./cgminer --bmsc-options 115200:0.57 -o POOL -u USERNAME -p PASSWORD --bmsc-voltage 0800 --bmsc-freq 1286
That's it! You can now mine your own bitcoins. If you have any more questions, don't hesitate to contact me.
Participated in the