How to Use Raspberry Pi to Farm Chia Coin

Raspberry Pi Chia Coin
(Image credit: Tom's Hardware)

After you’ve gone through the process of building Chia Coin plots on a PC (see how to farm Chia Coin), there’s no need to waste the electricity and tie up expensive computer hardware keeping those plots connected to the Internet. Instead, it’s best to take an external drive or drive(s) with the plots on them and hook them up to a Raspberry Pi where they can stay online, without gulping down too much juice.

In this tutorial, we will create a custom Raspberry Pi Chia farming device powered by the latest Ubuntu 64-bit release for the Raspberry Pi. The unit is designed to be hidden away, farming Chia Coin silently while we go about our lives. As such we chose to house the Raspberry Pi 4 inside of a passively cooled case. Our choice this time was the Akasa Gem Pro which has great cooling for the SoC, PMIC and PCIe chip and a rather tasteful, if unusual design. 

For This Project You Will Need 

Installing Chia On Raspberry Pi 4 

(Image credit: Tom's Hardware)

1. Install Ubuntu 21.04 to a 16GB micro SD card using the official Raspberry Pi Imager tool. You can also try a headless installation.

2. Connect your keyboard, mouse, screen and Ethernet cable. If you did a headless install, you can skip the keyboard / mouse / screen. Boot your Raspberry Pi 4 and complete the Ubuntu 21.04 installation process. Reboot the Raspberry Pi for all the changes to take effect.

3. Open a terminal and update the software repositories, then upgrade the system software.

$ sudo apt update
$ sudo apt upgrade -y

4. Install the openssh server to enable remote monitoring via an SSH session. After installation this will automatically start the SSH server as a background service. 

$ sudo apt install openssh-server

5. Install and start Byobu, a terminal multiplexer that will enable us to log out of the Pi and leave our Chia farm running.

$ sudo apt install byobu
$ byobu

6. Make a note of your Raspberry Pi’s IP address and hostname.

$ hostname -I

7. Install the Git version control software and a number of essential dependencies to build the Chia application.

$ sudo apt install git
$ sudo apt-get install -y build-essential python3-dev

8. Clone the Chia git repository containing the latest version.

$ git clone https://github.com/Chia-Network/chia-blockchain.git -b latest

9. Change directory to chia-blockchain and run the installer.

cd chia-blockchain
sh install.sh

10.  Activate the Chia virtual environment and create a new Chia config

$ . ./activate
$ chia init

11. Connect your USB 3.0 hard drive containing your Chia plot to the blue USB 3.0 ports on the Raspberry Pi 4. The drive will mount to a directory inside of /media/.

12. In the terminal change directory to your USB drive. Our test drive is at /media/les/Chia/

$ cd /media/YOUR USERNAME/DRIVE NAME

13. Add the plot from your USB drive to the Chia config using the 24 word key, created when the plot was created. Enter the command and then type the 24 words with a space between each word. 

$ chia keys add

14. Start farming the plot; this will also start services for your wallet. This command will only show that the process has started.

$ chia start farmer

15. Use this command to see the process of syncing our machine to the network and to confirm that farming has begun. The command will update every two seconds. This command can be stopped by pressing CTRL + C.

$ watch 'chia show -s -c'

16. Press F6 to detach from the current Byobu session. This releases us from the running session but it keeps the previous command to view our farming progress running in the background. Should you wish to go back to that Byobu session type this command.

$ byobu

It will take some time for the Pi to sync with the Chia network but it will still continue to farm as it syncs. Right now if you wish, you can unplug the monitor, keyboard, mouse. Leaving just the power, network and USB 3.0 drive connected. Your Pi will happily farm Chia quietly in the corner of the room. But to access the Pi we now need to use SSH, a secure shell terminal and for that we need to instal a client on our computer. 

Should you ever need to manually start the Chia farmer, for example after a reboot, start byobu and repeat steps 14 to 16.  

How To Remotely Access Your Raspberry Pi Chia Coin Farm 

1. Install PuTTY on your PC. PuTTY is used to make remote serial connections, SSH, with our Raspberry Pi 4.

2. Open PuTTY and in the Host Name or IP Address field enter the hostname or IP address of your Raspberry Pi 4. Click Open. 

(Image credit: Tom's Hardware)

3. Enter your username and password to remotely login to the Raspberry Pi 4. 

(Image credit: Tom's Hardware)

4. Open the Byobu session to see the current progress. 

$ byobu

Auto Mount USB Drive on Boot 

Should we need to power off our P, or there is power loss, we need the drive to automatically be ready to farm Chia with little interaction. It is best to connect your keyboard, mouse and screen for this part of the project but it can also be done remotely using an SSH connection.

1. With the USB drive connected, open a terminal and list all the attached devices. Our device is sda1 which is connected to the mountpoint /media/les/Chia. Make a note of your mountpoint, we will need this later. 

$ lsblk

(Image credit: Tom's Hardware)

2. Run this command to identify the UUID of your drive. Copy the text which starts UUID=. For example our UUID was UUID="b0984018-3d5e-4e53-89d9-6c1f371dbdee

blkid /dev/YOUR DRIVE

(Image credit: Tom's Hardware)

3. Open the filesystem configuration file, fstab with sudo.

$ sudo nano /etc/fstab

4. Add this line to the end of the file. Add your UUID after the =, and leave a space before entering the mountpoint. Here is how our drive is configured.

UUID=b0984018-3d5e-4e53-89d9-6c1f371dbdee /media/les/Chia/ auto nosuid,nodev,nofail,x-gvfs-show 0 0

5. Press CTRL+ X then Y and Enter to save.

6. Reboot the Raspberry Pi.

$ sudo reboot
Les Pounder

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • oxygenchaos
    Is it possible to connect multiple HDD to the Pi4 with sizes up to 18TB ?
    Reply
  • satai
    Just create a systemd unit to run the process automatically instead this workaround.

    (a different distro but a good intro to services: https://wiki.archlinux.org/title/systemd )
    Reply
  • lilyammy
    tomshardware should be renamed to www.tomseveryarticleisaboutrasberrypiandvirtualcurrency.com
    Reply
  • GoofyOne
    Awesome. Do you think a raspberry pi 400 will work ok ... not sure of it's cooling powers?
    If I end up doing it, I think I'll just be happy if I get my money back from what I spent on getting the extra hardware.


    {GoofyOne ... retired IT guy, all excited like a giddy little kid he may have found a new hobby :p}
    Reply
  • s.petmecky
    oxygenchaos said:
    Is it possible to connect multiple HDD to the Pi4 with sizes up to 18TB ?
    Short answer: Yes, undoubtedly.
    Long answer: This is Linux, you can connect Thousands of drives to it if you like. (though that will be less than efficient)
    If you're looking for maximum space, you could go with a NAS and fill it up with max capacity drives. Then link the RPi to it via a Network Share.
    You'll want to use something similar to this in your FSTAB on the RPi.
    //192.168.1.2/Share/ /plots/n/stuff/ cifs username=pi,password=<secret>,x-systemd.automount 0 0(edit the IP of your share, share name and folder, and your pi's secret password has to be allowed on the share)
    Reply
  • toaste
    Tom’s Hardware sure is publishing a disproportionate number of Chia articles.

    Tom’s Hardware and/or the authors need to add a disclosure for the amount of money or hardware equipment invested in Chia.
    Reply
  • Rogue Leader
    toaste said:
    Tom’s Hardware sure is publishing a disproportionate number of Chia articles.

    Tom’s Hardware and/or the authors need to add a disclosure for the amount of money or hardware equipment invested in Chia.

    Tom's would need to add such disclosure if this were true, however no such hardware or investment exists. Make no mistake if you continue to make slanderous accusations about Tom's Hardware you will be commenting elsewhere. Have a nice day.
    Reply
  • recursivecodes
    I'm confused. Is it required to set this up first on a PC? How does the PC come into play if you're farming on the Pi itself?
    Reply
  • drsierrac
    Hey y'all...newbie to cryptocurrency and Raspberry Pi here with no coding or anything background... I really appreciated the step-by-step directions in this article, but now I've hit a big roadblock that I can't seem to get around. I get to the 9th step where I'm trying to 'sh install.sh', and it keeps giving me this error message.

    ERROR: Could not find a version that satisfies the requirement clvm-rs==0.1.7 (from chia-blockchain) (from versions: 0.1.0, 0.1.1, 0.1.2, 0.1.4, 0.1.6, 0.1.7)
    ERROR: No matching distribution found for clvm-rs==0.1.7

    Please help!! (and yes, I've upgraded to Raspbian 64, so that's not it...)
    Reply
  • GoofyOne
    Hmmm Raspbian may be the wrong OS, ... you may have to install Ubuntu OS to get the Chia farming setup going. I actually don't do Chia farming (at least not atm), but I tried setting up the Chia farm software on my Raspberry Pi 400 using Ubuntu 21.04, and it installed fine going by the directions given.

    It's probably only a fairly minor difference, but unless you are a expert on Linux, could be difficult to track it down.


    {GoofyOne's 2c worth}
    Reply