How to Mine for Bitcoin with a Raspberry Pi

As a part of my independent-studies at GWMSIST, I researched how to build cryptocurrency mining rigs; this blog is segmented into a two part-series tutorial which I’ve outlined below, beginning with the purchase of a parts list and Raspberry Pi set-up segueing into configuring the Bitcoin mining client with Minera; each part includes the corresponding YouTube screencast embedded directly beneath each segment- enjoy!

Part 1: Raspberry Pi Set-up and Installation

Required Components

  1. Raspberry Pi: CanaKit starter-pack recommended- available via Amazon.
  2. USB-mouse
  3. USB-keyboard
  4. SD-card reader.
  5. HDMI-cable
  6. Access to an external-monitor or LCD-television via HDMI.
  7. Physical / LAN-Internet connection.

YouTube Tutorial – Part 1

I provide a YouTube screencast for Raspberry Pi set-up and configuration introducing Bitcoin-mining as part-1 of a 2-series tutorial via YouTube.

Part 2: Minera Client Install

Required Components

  1. GekkoScience 2-Pac Compac USB Stick Bitcoin Miner (15gh/s) available via Amazon or eBay.
  2. If you’re attempting to maxmimize your env hash-rate beyond additional two ports provided by Raspberry Pi, I’ve only had success with industrial-grade external USB 20-port or 10-port hubs- also available for purchase at Amazonor eBay. 3.. Do not forget to purchase a USB powered-fan to cool any ennvironments supporting an external USB-hub- also available via Amazon or Ebay.

Minera Client Installation and Configuration

  1. After setting-up your Raspberry Pi environment, launch terminal and run curl -o- https://raw.githubusercontent.com/getminera/minera/master/install_minera_ubuntu.sh | sudo bash
  2. Go to http://IP-address-of-your-local-mining-host/minera
    1. Download nmap and run nmap -sP 10.0.0.0/24 to locate the Minera host-IP address.
  3. In my case, my local-Minera URL is (http://10.0.1.102/minera). Upon access, enter the default username and password ‘minera’ (you’ll want to change this later in Settings > User for InfoSec).
  4. Go to Minera Settings > Open Terminal
  5. Again, enter default minera username and password if you haven’t already changed them yet.
  6. Minera configuration:
    1. cd /var/www/minera/minera-bin/src
    2. sudo mkdir -p git/vthoang; cd git/vthoang
    3. sudo git clone https://github.com/vthoang/cgminer.git
    4. cd cgminer
    5. sudo apt-get install libusb-1.0-0-dev
    6. sudo CFLAGS="-O2" ./autogen.sh --enable-gekko
    7. sudo make -j 2
    8. cp cgminer /var/www/minera/minera-bin/custom/cgminer-vthoang
    9. cd /var/www/minera/minera-bin/custom
    10. exit
  7. Return to minera-client homepage and select Settings > General
  8. Enable all radio-buttons featured in the Dashboard panels section to “On”.
  9. After creating your account at slushpool, In the “Pools Settings” section, enter your slushpool-url, username.workername, and pool-password (E.G. “stratum+tcp://stratum.slushpool.com:3333”, alexanderjsingleton.King, password)
  10. Under the “Custom miners” section slide radio-button to on (there should be a cgminer-vthoang flag-indictor next to the button).
  11. Within the “Local Miner Settings”, under the “Currently selected” dropdown-bar, select “[Custom Miner]cgminer-vthoang” and below that dropdown-bar, there is another- select “–Preconfigured miner options–“.
  12. Below that section there are two radio-buttons for “Enable logging” and “Append JSON conf (-c /var/www/minera/conf/miner_conf.json)”- slide them to “On.”
  13. In the Manual Options sections, input the optimal hash-frequency parameters for your miners (E.G. for GekkoScience multiple 2-Pac-sticks --gekko-2pac-freq 150 OR if different sticks enter --gekko-compac-freq 200 --gekko-2pac-freq 150).
  14. Slide the last three features to “On”
    1. Autorestart if devices are possible dead.
    2. Miner Autorecover
    3. Miner superuser (root)
  15. Click Save & Restart

Return to the Dashboard- allow 5 minutes to compile and BOOM, you’re a regular Bitcoin lemming!

Adding Additional Hardware or Revising Parameters

Any hardware additions to an existing Raspberry Pi * Minera environment or any adjustments to the hardware parameters specified in Minera Settings > Manual-options do indeed require recompiling cgminer. In order to resolve, proceed with the following:

  1. cd /var/www/minera
  2. sudo nano build_miner.sh
  3. Scroll down to the cgminer config and append --enable-blockerupter so the entire line displays CGMINER_CONFIG="--enable-avalon2 --enable-bflsc --enable-bitforce --enable-bitfury --enable-drillbit --enable-hashfast --enable-icarus --enable-klondike --enable-modminer --enable-blockerupter"
  4. Exit and Write.
  5. Run sudo ./build_miner.sh all
  6. Upon compiling, exit from your host-session, unplug the antsticks, power-cycle the Raspberry Pi and then plug-in antsticks.
  7. Log-in to the Raspberry Pi and sign-in to Minera- you should see verifiable success displayed in the Minera Dashboard > Device Tree.

YouTube Tutorial – Part 2

I provide a YouTube screencast for Minera-client installation and configuration on Raspberry Pi utilizing GekkoScience-USB sticks as part-2 of a series tutorial via YouTube.

Leave a Reply

Your email address will not be published. Required fields are marked *