Getting started with the Chia Network on the CLI
Chia farming does not have this much light

Guide on How to Mine the Chia Network with Ubuntu with the CLI

The one and only
4 min readMay 5, 2021

When I was first getting started it was rather difficult to find out all of the information that I needed to understand how the mining process works and the best way to get started. If you are like me, have some headless Ubuntu server, and just need a way to get started read on. (Skip to CLI setup)

How does mining on the Chia Network Work?

For miners of the network, we need to only be concerned about the generation of plots — called plotting and farming the plots.

  1. Plotting: This is the first step, you need to generate a plot to farm (analogous to real farming). It is a Read/Write heavy operation that you want to do as fast and efficiently as possible. The typical generation of a plot on a regular spinning disk hard drive today is around 9–10 hours. The plots once made are expected to last 5–10 years. It gets more complicated if you want to go faster and we will get into more complicated setups in the following articles.
  2. Farming: Lighter operation compared to the generation of plots. In this step you want to maximize the number of plots that you farm. So, maximize the storage size that you are farming. We care more about minimizing $/TB for purchase price and electricity idle. (Quick tip if you are looking for cheaper hard drives: these WD drives (ref link) are shuckable ie. you can get out usually an internal drive to place in your machine)

Great so back to our server.

Setting up Farming on the Chia Network with the CLI

(Note: some of the following was obtained from the chia wiki)

# Run updates
sudo apt-get update
sudo apt-get upgrade -y
# Install Git
sudo apt install git -y
# Checkout the source and install
git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
cd chia-blockchain
# Install
sh install.sh

That is it, you have now installed Chia Network, next step is to initialize the nodes and save your private keys.

# Activate the virtual environment in dir chia-blockchain
. ./activate

Now enter the next command to start the wallet and generate your private key as well as passphrase. Be careful, do not share your private keys/passphrase with anyone else.

chia init

Now that the wallet is setup, we can start the services.

# will start the farmer, harvester, a full node, and the wallet.
# Note: adding -r at the end will restart the service.
chia start farmer

Next step is to start plotting. Make sure you identify which drive you want to do the plotting on before starting this step. In general, its not a good idea to do this on the drive that your boot lives on.

First, lets use tmux to help ensure this runs after we disconnect

sudo apt-get install tmux -y# Start tmux
tmux new -s plot
# Activate venv
cd chia-blockchain
. ./activate

The simplest command to get started with running a plot.

# k = 32, this controls the size of plot. Minimum is 32
# n = 100, Number of plots, pick a high number
# t = folder location, this is where the plot gets generated with heavy Reads/Writes. You want this to be a faster drive.
# d = destination folder, this is the destination for where you want the final plot will stay, slower is fine.
chia plots create -k 32 -n 100 -t /mnt/a/generating_plots/ -d /mnt/a/plots/

Note: To disconnect from tmux, ctrl-b then d. To reattach, tmux a -t plot

This it! You are now generating plots. As soon as a plot finishes, the farmer that we started earlier will pick it up and start farming. To verify this you can run while having the venv activated:

chia farm summary

Initially you should see something like this:

Farming status: Farming
Total chia farmed: 0.0
User transaction fees: 0.0
Block rewards: 0.0
Last height farmed: 0
Plot count: 4
Total size of plots: 405.432 GiB
Estimated network space: 2185.329 PiB
Expected time to win: 2 years and 11 months

In a following articles, if there is interest, I can go into the specifics of building a plotting machine, the huge number of options for a farming machine (remember plotting and farming can be done on the same), and some more advanced ways to optimize the plotting process.

Reference:

Find many more settings and flags on the CLI wiki page.

--

--

The one and only
The one and only

Responses (3)