How to mine bitcoin for under $99 dollars 

How to mine bitcoin for under $99

For Christmas this year my wife and I decided to ‘pass’ on buying gifts for each each other. With $170,000 in student loans — we both thought it was the financially prudent thing to do. Instead, I decided spend my Christmas week setting up a ‘bitcoin mining rig’, for as cheap as possible. I thought, “what the hell, I have an undergrad in computer science, it’s just a bunch of zeros and ones, i’ll figure it out”. What was originally supposed to be an afternoon activity quickly turned into a week long mission on “getting this damn thing working”.

By the end of this story, you will have a fully functioning mining rig connected to a mining pool with a bitcoin wallet. All for under $99. Not surprisingly, alot of the tutorials I found on the net skipped a ton of major steps and didn’t address common problems like limited power utilization from the raspberry pi when used to power the mining stick.

Here’s all the software and hardware you’ll need for this tutorial. Each step will break it down line by line.

Components to build a $99 bitcoin mining rig

Step 1 — Select your hardware

Although I secretly had grand dreams of massive wealth creation, I knew that it wasn’t going to happen with this rig. You need to know, and accept that as well. This is not going to make you rich, this isn’t even going to make you a profit, even if bitcoins jump back to $20,000. So take this as a learning experience and do it on the cheap. Consider this DIY project a financial investment in your future.

Step 1a: Buy a machine — Raspberry Pi 3 — Cost : $30USD

Raspberry pi 3

This is a bare-bones machine powered by a distro of linux called Raspbian. Don’t buy the upgraded versions w/ premium casing or an upgraded power supply. The $35 will work. Get it on the cheap, you’re here to learn.

Step 1b: Buy an ASIC USB mining stick — Gekkoscience 2pac USB — Cost : $35USD

Gekkoscience 2pac usb mining stick BM1384

Your RasPi3 is not going to mine the bitcoin for you. It is the device which is used to connect to the actual ‘mining rig’, in this case, a USB bitcoin stickminer from Gekkoscience. The technical documentation indicates up to 15 Gh/s but the Raspberry Pi 3 doesn’t have enough voltage ‘out of the box’ to run it at full capacity without an external power supply. We are doing this on the cheap and as a result you can realistically expect somewhere around 7Gh/s.

In fact , the max G/hs I was able to achieve was > of 9Gh/s within the slushpool mining pool:

gekkoscience BM1384 2pac hash rate on slushpool

Step 1c: Buy a microSD card + adapter — SanDisk 64GB — Cost: $28USD

The raspberry pi 3 doesn’t actually come with any disk space, but it has a MicroSD port which can be used to install the Raspberry PI OS (Raspbian), mining pool binaries (cgminer) and distro updates. 64gb is plenty.


Step 2 — Set up the Raspberry Pi

So you now have the cheapest raspberry pi 3 you can find, a gekkoscience 2pac usb miner BM1384, and a 64gb microSD card + adapter. Next we download the Raspberry Pi Raspbian OS, format the SD card, install the raspberry Pi OS onto the SD card, and enable SSH tunneling. Here is the software you’ll need to download, don’t worry, it’s free. By the end of step 2, you will be able to remotely connect to your RasPi3

Step 2a: Download the Raspbian Stretch with Desktop and recommended software

This contains the single image (.img) for the Raspbian OS. Download the zipped version and unzip to directory of your choice, in my example I unzipped it to C:rasp

When you unzip the extract you should see a single .img file:

Step 2b: Format the SD card using SD Card Formatter

The blank microSD you bought needs to be formatted prior to having the raspbian img installed. My MicroSD card automaps to drive D, which I used to format as outlined below. This is a 3 click process.

Step 2c: Install the Raspberry Pi Raspbian OS using Win32Disk Imager

Use Win32Disk Imager will decompress the .img file and install the Raspbian binaries to the microSD card.

If you open the microSD card, you will see the following.

Step 2d: Enable ssh on the Raspberry Pi OS

So i’m not connecting a monitor directly to the raspberry pi because it doesn’t have enough voltage to support my HDMI display and I’m sure as hell not going to buy a new monitor for this experiment. As a result, i’m going to connect to raspberry pi via via a remote terminal called ‘putty’ , this is also called ‘headless’. To enable ssh, create a file called ‘ssh’ (without ‘), no extension, into the root directory of the microSD card. When the raspberry Pi boots up, ssh will become enabled, and the file will be deleted.

To enable ssh, create a file called ‘ssh’ (without ‘), no extension, into the root directory of the microSD card. When the raspberry Pi boots up, ssh will become enabled, and the file will be deleted.


Step 3 — Moment of truth — Power on the Raspberry Pi 3

This is the first time we’ll actually power on the mining rig. Keep in mind it needs to be located somewhere close to your modem or router. Cross check against the list below to confirm the physical configuraiton of your RasPi3 is correct.

1. The MicroSD card embedded into the Raspberry Pi micro SD port 
2. The Gekko USB stick connected to one of the 4 raspberry pi USB ports 
3. The Raspberry Pi connected to your network via a cat 5 cable 
4. The Raspberry Pi should be powered on

Here’s a snap of my actual machine . It’s being housed on top of one of my corporate finance books I had to read as part of my MBA. That book probably cost somewhere around $20,000 🙂

Note that you can verify by confirming the fan is active and both the Raspberry Pi & Gekkoscience USB stick should have a solid green light.

Here’s a pic of the cat5 cable running to my router.


Step 4 — Connect to the Raspberry Pi

Now you have a raspberry Pi powered on somewhere in your house..maybe your closet? But your laptop is somewhere else, how do we connect to the raspberry Pi? The answer is command line via putty. In this step we will need to download 2 applications:

Step 4a: Find the Raspberry Pi 3 IP Address with Advanced IP scanner

The raspberry Pi is sitting somewhere on your network, and you need to know your IP address in order to ssh into it. Using Advanced IP Scanner on my network i’m able to find the machine under IP address 10.0.0.191. You can see I have other devices on my network, IP/mac addresses have been redacted.

Step 4b: Connect to the Raspberry Pi via putty

When we open putty, let’s be sure to connect to the IP address associated with the Raspberry Pi device which we found in our previous step, in this example — 10.0.0.191

Once you hit open, connect with root account:

Username = pi
password = raspberry

Do you feel like like the hacker from the 80s classic movie War Games? Because I definitely did.


Step 5 : Install OS Updates and required binaries

This was probably one of the most difficult steps because there are a series of required binaries which need to be installed prior to connecting to the miningpool via cgminer. The existing documentation doesn’t cover the pre-requisites files, and if you don’t install all of the required binaries you will get error messages like the one below when launching cgminer:

AM_PATH_LIBGCRYPT missing; CLI tool will not be available

Step 5a: Run the following command lines:

sudo apt-get update;
sudo apt-get install git-core -y;
sudo apt-get install autoconf autogen libtool uthash-dev libjansson-dev libcurl4-openssl-dev libusb-dev libncurses5-dev;
sudo apt-get install libevent-dev;
sudo apt-get install libusb-1.0;
sudo apt-get install build-essential pkg-config libjansson-dev uthash-dev libncursesw5-dev libudev-dev libmicrohttpd-dev libhidapi-dev;

You can try to run these in one big apt-get install command but I found peace with myself by running each command in smaller breakout statements.

All of the apt-get install commands should produce a series of steps similar to the screen above which culminate with a successful ‘done’.


Mid-way Checkpoint

We are half way through this odyssey. Let’s recap what we’ve done so far:

1. Bought the cheapest possible mining rig equipment possible
2. Installed the raspbian Pi OS to a micro SD card
3. Added the raspberry pi 3 to our local network
4. Installed required binary and OS updates

We have now completed all pre-requisites and we’re ready to to mine. Next we’ll:

1. Create a bitcoin wallet
2. Join a bitcoin mining pool
3. Add our mining rig to the mining pool
4. ??
5. PROFIT!

Step 6 — Get a bitcoin wallet

Theoretically, if you were to successfully mine a bitcoin, the mining pool would need pay you that bitcoin (less their mining fees). To do this they would transfer the currency to your wallet. There’s a ton wallet options available at bitcoin.org . I decided to chose edge because I could install it on my iphone and it would provide me with a receiving wallet address with a few clicks. There is a general consensus in the bitcoin community that online wallets are a terrible idea, so proceed with caution.

Once you have your account set up, you’ll be provided with a bitcoin receiving wallet address like mine below:

Honestly if you have an existing bitcoin wallet through coinbase, etc, it can be used for this tutorial. This rig is not going to mine enough bitcoin to meet the minimum payout requirements of the major mining pools. In our example, slushpool.



Step 7 — Join a mining pool

Imagine you want to mine gold, in real life. You have 2 options:

Option 1 — go mine gold on your own with your own resources
Option 2 — join a large group which is already mining gold, and share in the gold which is found.

Bitcoin is no different, we’re going to join a mining pool and allocate the resources (Gigahashes) from our machine into the pool at large. In exchange, we’ll share in the pool’s profits and pay the pool operator a small fee of 2%. In this step, we are joining a mining pool called slushpool .

As of January 2019 there were around 13 major bitcoin mining pool operators. I’ve chosen Slushpool since it was the first mining pool created, and has an easy to use GUI.

Step 7a: Make a slushpool account and add your bitcoin receiving wallet

When you register an account a slushpool you can navigate to Settings -> Bitcoin -> Payouts and add the bitcoin receiving wallet address created in step 6 to your slushpool profile.

Step 7b: Save your Slushpool Server Address

When you register an account a slushpool you can navigate to Settings -> Bitcoin -> Payouts and add the bitcoin receiving wallet address created in step 6 to your slushpool profile. Under Help Center -> Getting Started Bitcoin you will find the slushpool server addresses currently available. As of January 2019 we are going to use US east. Take note and save it for step 9.


Step 8 — Configure the cgmining software on your raspberry Pi 3

We need to download and install the software that will actually perform the mining. So far we have the hardware (gekko USB stick) and a mining pool account (slushpool). We are going to install Cgminer on our raspberry pi, which will use the gekko USB stick to mine bitcoins within the slushpool mining pool.

I originally spun my wheels for nearly a week trying to get BFGminer working on the raspberry pi only to find out (as of this writing) there isn’t a clear path to configure the Gekkoscience USB 2pac BM1384 with BFGMiner. This was a painful less that I hope you can avoid. See the official threads:

For this reason, and 3 micro SD card formats later, we’re using CGminer.

Step 8a: Download & configure cgminer

We need to download a forked version of cgminer which was built specifically for the Gekkoscience 2pac USB BM1384 devices. Here is the official support thread, you should bookmark this as I spent hours combing through the 106 page thread.

Within your putty terminal, run:

mkdir -p git/vthoang; cd git/vthoang;
git clone https://github.com/vthoang/cgminer.git;
cd cgminer;

This will download the fork of the Gekkosicence 2pac USB cgminer codebase located at github.com/vthoang. Now run the configuration shell script for cgminer and recompile the folder using the command ‘make’

CFLAGS=”-O2 -march=native” ./autogen.sh — enable-gekko;
make -j 2;

Grant cgminer access to the gekkoscience 2pac usb miner by running:

cd ~/git/vthoang/cgminer/
sudo usermod -G plugdev -a `whoami`
sudo cp 01-cgminer.rules /etc/udev/rules.d/
sudo reboot

If you don’t do this, when you run cgminer you will get a “USB init, open device failed” … “you don’t have privilege to access” error. Note that this command will also reboot your Raspberry Pi 3.


Step 9 — Start mining some bitcoin!

Getting to this step took a better part of a week, with a bunch of trial and errors. My big hurdles were understanding the compatibility problems with BFGminer and the power limitations of the gekko USB stick. To run cgminer , enter the following command via putty to your raspberry pi:

./cgminer -o stratum+tcp://us-east.stratum.slushpool.com:3333 -u yourslushpoolaccount.slushpoolworkername -p x — suggest-diff 32 — gekko-2pac-freq 100

Replace “yourslushpoolacount.slushpoolworkername” with the information created in step 7a.

What do you see? Failure? I noticed that whenever I ran cgminer at BM1384’s default speed of 100mhz, the USB device would enter disabled or zombie mode , which means that no mining is taking place. When we review the official Gekkoscience 2pac usb BM1384 support thread  we see that in post 10 of page 1, a warning to all raspberry PI users:

Unfortunately I didn’t see that warning..for atleast 6 hours. A tough lesson that I hope you can avoid. Since we’re doing this on the cheap and and want to spend as little money as possible , instead of going out and buying a powered hub, we’re going to reduce the frequency of the stickminer from 100mhz to 50mhz. Run the following command in putty. Note how we’re telling cgminer to reduce the mining speed to 50mhz.

./cgminer -o stratum+tcp://us-east.stratum.slushpool.com:3333 -u yourslushpoolaccount.slushpoolworkername -p x — suggest-diff 32 — gekko-2pac-freq 50

If the stars are aligned and you click your heels together 3 times, the cgminer installed on your raspberry pi 3 will join the slushpool us east mining pool and mine bitcoin with the gekkoscience 2pac usb 1384 mining stick:

While I was writing this, gekkoscience released a newer version of its mining stick with hardware 1387. If you’re unable to find a 1384, you can use a 1387 but I would avoid buying it if a 1384 is available. These mining sticks have a payback period of never.

2 thoughts on “How to mine bitcoin for under $99 dollars 

  1. I used to be addicted to gambling and i stopped last November.My life changed the moment i met a professional crypto/bitcoin mining expert.He helped me with bitcoin mining that i make $10,000 from weekly.i will forever be indebted to this binary expert for the great services he’s got,he helped me up when i was almost selling my inherited house from my dad.He assisted me to acquire lots of money through his mentorship.i am confident to introduce him to you all and you can contact him as well on here [CryptobinaryExpert AT Hotmail dot com]if you need help mining bitcoin for Gain,retrieval of frozen/stolen bitcoin wallet or any related crypto currency investments.

  2. I needed to send you a very little remark just to say thanks as before for those stunning things you have documented at this time. This has been certainly shockingly open-handed with you to give freely just what a number of people could have supplied for an ebook to end up making some profit on their own, especially considering the fact that you could have tried it in case you decided. These strategies as well served to provide a easy way to fully grasp the rest have the same zeal like my personal own to understand more pertaining to this issue. I believe there are several more pleasurable opportunities ahead for those who examine your blog post.

Leave a Reply

Your email address will not be published.