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
- Raspberry Pi 4 4GB
- Raspberry pi case, perhaps one of the best Raspberry Pi cases, with cooling
- An external USB storage drive or SSD / HDD with USB 3.0 caddy.
- 16GB Micro SD card or larger
- Raspberry Pi Imager tool
- Accessories to use your Raspberry Pi 4
Installing Chia On Raspberry Pi 4
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
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.
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.
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.
3. Enter your username and password to remotely login to the Raspberry Pi 4.
4. Open the Byobu session to see the current progress.
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.
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
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