Raspberry Pi - Project 02 (BTC Mining for Beginners')

Raspberry Pi - Project 02 (BTC Mining for Beginners')

By Mynima | Hobbyist Mining | 16 Mar 2020


Introduction

For anyone interested in my other mining blog posts (with GPUs and specific coin, then they can be found here). Otherwise, lets get going with the first of the crypto mining Pi Projects.

Before I begin there are a couple of things to remember; Firstly unless you have an extensive mining setup you're unlikely to get rich (or break even) and Secondly I take no responsibility for any issues you run into if you try this at home (be smart, download any software at your own risk).

As we dive into the guide I recommend if you've not already set up your raspberry pi then follow my precursor setup guide first then come back: https://www.publish0x.com/hobbyist-mining/crypto-pi-project-01-beginners-set-up-guide-xnmvmw. As the first guide didn't have really any crypto project going on I wanted to follow it up quite quickly with the first of the real projects. For this article I thought we'd start simple and ease into using the Pi, we'll look at mining the big boss of coins Bitcoin (BTC). Sure, it isn't profitable to mine as part of a pool at the current hashrate, but let's roll the dice, today we're 'Lottery' mining!


Step 1: The Wallet

First of all we're going to look at the quickest way to get up and running with this project. As such I'll be using a Trust Wallet address. Now normally if you've got Bitcoin the safest place for them to be in a secure private wallet. However, since we're lottery mining the likelihood is that we'll not get anything but in the event that you do you can use the Trust Wallet as an easy intermediary.

Trust Wallet is a multi-coin app for your phone, I gave a simple setup guide for it here in my Tezos Staking and Aion Mining articles. What I will say is if you haven't got the wallet yet and would like an added bonus (100 Trust Wallet Tokens, TWT), then you're more than welcome to use my referral link: https://share.trustwallet.com/1K18DM. Otherwise, head on over to your respective app store and download it from there.

Once you have it set up, you should see BTC from your main screen. Click on it and then on the next screen (image below), click on 'copy'. My recommendation here would be to go across to your emails and paste/send the address to yourself so that you don't need to manually type it in later.

Wallet


Step 2: The Mining Software

Once the wallet is sorted we'll need to go ahead and get our Pi set up with the mining software. I'll be doing this from the terminal on my raspberry Pi's desktop. So I'll assume you're doing the same and have loaded up the TightVNC connection. Otherwise, the steps still work if you just access the terminal through PuTTY (head back over to the original set-up guide if this information has you lost). 

We're going to use CPUMiner here, I will cover another mining software (CGMiner, in a later article). For now though, we're just going use the Raspberry Pi's CPU to do the mining. So let's get it set up:

  • 1 - First of all, while we are here, we may as well make sure our Pi software is all up-to-date. 
sudo apt-get update
sudo apt-get upgrade
  • 2 - Now we need to install all the dependencies for the miner
sudo apt-get install -qy automake autoconf pkg-config libcurl4-openssl-dev libssl-dev libjansson-dev libgmp-dev make g++ git
  • 3 - Once these are done installing and it returns to the "~$", we now need to clone CPUMiner (you may be prompted for a GitHub login and password, if you don't already have an account nip over to https://github.com/ and sign up, it only take a couple of mins)
sudo git clone https://github.com/tpruvot/cpuminer-multi -b linux
  • 4 - Next we want to navigate to the folder, and compile CPUMiner
cd cpuminer-multi
sudo ./build.sh

Step 3: The Pool

For this kind of a task (without running your own node, well look at that in future weeks), we want to focus on solo mining pools. As I mentioned earlier given the low hashrate of the Raspberry Pi we cannot really expect to make anything using a normal pool as we wont contribute enough to even get to the lowest payout thresholds.

The pool I recommend here is http://solo.ckpool.org/

It has a 1% fee with no signup needed. When you head over to the site get a hold of the appropriate pool address for your region, you'll need it when we move on to the last step.

pool


Step 4: Mining

So we've got CPUMiner set up, a wallet address and have the pool we're going to mine with. Now we're on to the final stage, mining. For this there are just a few steps left.

  • 1 - Create a new file on the desktop of you Pi (I've called it "Start BTC" in this example). The reason I do this is so I don't to go find the input values for the miner next time I reboot my Pi
  • 2 - In the file add the following information, replacing the bits in "< >" with the appropriate information for your own wallet address. Note the "-t" option relates to the number of threads you wish to run, adjust this as appropriate.
cd cpuminer-multi
./cpuminer -u <address> -a sha256d -o stratum+tcp://solo.ckpool.org:3333 -t 4
  • 3 - Copy and pastes the commands into the terminal and hit enter

mining

Congratulations you're mining BTC!!

Now that you are mining you can check your stats (when you've submitted a share, it may take some time!), on ckpool site by navigating there on your favorite browser (#BRAVE) and just have your address to hand and you can paste it into the bar in the middle of the main page and hit enter. Or add your address to the end of http://solo.ckpool.org/users/<YourAddress>. You'll see all your stats on the next page.

 

Hope you enjoyed the guide, good luck y'all!

 

Donations Welcome (BTC):

bc1q3tjzj24nc4xhjjwha65dtkwn9peas0uv0v09wh


Mynima
Mynima

Hobby miner and Crypto interested programmer. https://mynima.github.io/


Hobbyist Mining
Hobbyist Mining

Mining: Tips and how-to guides from one beginner to another.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.