HOWTO: Chia Farming on SCALE

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
TrueNAS SCALE Fans,

Like many of you I’m a bit of a nerd (total shocker I know) who’s into things like CryptoCurrency. I recently got Chia setup on TrueNAS SCALE and wanted to share how I did this for others who may be interested as well. For this walkthrough I was using TrueNAS SCALE nightly images, but the process will be similar on 21.04-ALPHA.1.


To prepare your TrueNAS SCALE system for Chia farming, you first will want to create some datasets. In this example we create a parent dataset tank/chia, and then nested datasets of tank/chia/config and tank/chia/plots. These will be exposed to your container and keep your configuration and plots persistent across upgrades.

QYPRtHol4HaennApevNOplI_NY68vYKJ-HcoePPkJX0dL_fENb1MbGLaHs2Rf-hYB942OM9s5MI5QeoAQP9U84j7AJSAzNSOOrBoXBAUDLMauE8GNyjUO0kla9WDw5M2XQREwS6t



With the datasets prepared, next step is to navigate to the Apps page and click on the Launch Docker Image button.


Is8V3fu8zMhwEsTp__VuOfxZ6-QdH4j4b1LGpRKz3oZy126OdfYJIDhrt5yCLDTUWxzzDelDkX1sXF2Sb8Kj2ZUIgpV0RZ2manwErRiuok_U_cVnCtW3Z_JEeStu1b27kDkt00i9


On the first section of the wizard, we will begin by setting the following parameters:

Name: chia1
Image Repository: ghcr.io/chia-network/chia
Image Tag: latest
Update Strategy: Kill existing pods before creating new ones


9uLTCmEwsskQGlVHtw2bcToPTvw1oKmYZe0G7ueWHdqP5dqHB4y_h0tkrVNRSJfnxQMIFh5aKywPxVzk_kt3heeYcFMHtPzH2vTuhuwOz_nuRlH3xUsOe_5E8-LJ7F5BkE4nGu4Y


Click Next until you reach the Networking section. Here we will be using the Host Network option. Select it and click Next.

NOTE: Chia network often requires that port 8444 be exposed to the outside world. Please refer to your router documentation on how to best port-forward 8444 to your TrueNAS SCALE system.

iTUcFby7WN1MAfdokpMc4TKPnrGlKHbkbxCck3ZfR8y8SnJTPseg2LVfnnAJEkvaYqZUEBIUL1AicJw-KCPUrXpm9I4fSFQvM0DSw2nkQRcqZGIUKLy7uGCQmArd-2XsXvfl3tX9



Keep clicking Next until you get to the Host Path Volumes section. Here you will now expose the datasets we previously created to the container. Create two entries for the following, replacing <tank> with your pool name.

Host Path: /mnt/<tank>/chia/config
Mount Path: /root/.chia

Host Path: /mnt/<tank>/chia/plots
Mount Path: /plots
uooMO1z2fd5Yb8j-AXKxhLXc8xwwl52NEZyekKQLXKhlviqrOF0ynM-iOemMFoYrLqeC_oGfnqKKGbcDN4_h6jl38mw94hL5WoqJr_Y43HdZ63fJZsJHjVf_yyFz8vGlZWBCDFC6



Continue though the wizard and create the new application. After a minute or two the new chia1 container will be started and listed as “ACTIVE”. At this point we need to click the three-dot menu on the top-right and launch the Shell.


b1NWBjLSvNhpzEgnwJgIJMSCvjdaVUYVtcZToARXgH36rvc8rfP4Ajasd2RQxCZaH8w0Y3W9HZ46SoUFMC7P4Yv77bo5xIl1yCPqsLwIyYGzH6NgsPkxj5jYi95yxTt5qoJEE2m5


Take the defaults for the pod (There is only one) and use the selected /bin/bash shell.


9h3Pjg8GkozANFOKXgEBJZ55W2o4_3hKJxFiibqwpBynnjx30KoQeofHG2_7UVopM7KjiQ4LBgVmzZPJQQt5B6uvd3vceC9xy5mtNFf7GjFGibPsccZF4cogtNebtHB-j19Oo5DR



The first time Chia launches, it will automatically create a new private key set which is for your plotting, as well as wallet. However this will not get preserved across container restarts. To make sure your keys and wallet persist, we need to save the Mnemonic Seed which was magically created and make sure it gets used at each container initialization. To do this, start by displaying the current key information:

# /chia-blockchain/venv/bin/chia keys show --show-mnemonic-seed




NIxbZ-XkWS-xk6CMEU789bNls9pvfusHJquxnvcdvnv4zH3AtE4p0UHQdgHBHPs6e50xCIUzNoXIqTZ_FlvIrrC5RejvFsbsOzhROEAFfii90l6tM0cnylPZkRlO7XJQawtpafWh


If you entered the command correctly, you should see some output that looks like the above screenshot (minus the redaction of course)

You’ll want to make a backup copy of the information provided here for your reference in case you lose the keyfile somewhere along the line. To make sure the same key is used for this container going forward, we will be saving the mnemonic-seed phrase to one of our host volumes on TrueNAS.

Copy and paste the 24 secret words of the mnemonic seed into a new shell command:

# echo "my unique 24 secret words here" > /plots/keyfile

With this done, exit the shell and go back to the Installed Apps page and click Edit on your Chia container.


ndPlySCLDX_AKb_Ci8ssi-sWBUVydmmBMVztF3g54kGu_LiBdEdPFP8n-zidyWOQf9uNMhZmBloq9tIXek8-p5Hj2e4vutwcbpPsWxpZzQa85ATMN3XIiEWNwqpBW972Apm0Oso3


Scroll down until you find the Container Environment Variables section and add a new variable as shown below:

Environment Variable Name: keys
Environment Variable Value: /plots/keyfile

NOTE:
There is a bug in SCALE 21.04-ALPHA and later where you cannot set Environment variables via the UI. (Might be fixed in nightly images by the time you are reading this). To work-around you can instead use the following command from the TrueNAS Shell:

# midclt call -job chart.release.update chia1 '{"values": {"containerEnvironmentVariables": [{"name": "keys", "value": "/plots/keyfile"}]}}'

enhBqg_hIs87tN9bGJe9l-vRNvC6DlvFvqmZ8ZH8B5ggw6iG491T-AjuAjAOWWwYHDfNprBYNUA7qkttmxsotESpKeSg3MnmqeFs_CimGK-fdqYchiuQQsDqgVtfWAaRywCTn5eL


Save the change, and the chia container should restart automatically. To confirm your changes have persisted you can log into the containers shell again and run the same “/chia-blockchain/venv/bin/chia keys show --show-mnemonic-seed” command to show your keys. If the keys are identical to what you previously recorded, then congratulations you are done! This Chia container will persist across reboots, upgrades and re-deployments.

At this point you are all ready to begin farming Chia. This is a CLI process and beyond the scope of this quick how-to, but I recommend you start by reading up on their CLI reference materials, Quick Start guide and other documentation.
 

-Simo01

Cadet
Joined
May 8, 2021
Messages
4
Hi! I have installed the new chia apps provided by Official Catalog.

How can i add container Environment Variables in this app?
 

-Simo01

Cadet
Joined
May 8, 2021
Messages
4
i'm following this guide, so i'm trying to add this variable.

Scroll down until you find the Container Environment Variables section and add a new variable as shown below:

Environment Variable Name: keys
Environment Variable Value: /plots/keyfile
 

-Simo01

Cadet
Joined
May 8, 2021
Messages
4
I am using the app provided in the official catalog, so I was following the guide but with the app.

btw I went to see the chart on GitHub, and it already does this thing. So solved. Ty
 

waqarahmed

iXsystems
iXsystems
Joined
Aug 28, 2019
Messages
136
Yes the app already handles that @-Simo01. Thank you for confirming.

For clarification, if you are using the official application, there is no need to follow the steps mentioned. You can of course specify custom host path if you want, but nothing else is required wrt configuration. The application handles that.
 

Johan01

Dabbler
Joined
May 15, 2021
Messages
18
Hi, in my opinon the chia app needs addition mounts next to config and plots. In current configuration the creation of plots happens on the apps pool's drives. If these are (consumer grade) SSDs of NVMe's they will wear out on TBW pretty quickly. Therefore I prefer to have additional mount points for the "-t" en "-2" options so that the creation can take place on dedicted, enterprise grade NVMe drives without affecting the other installed apps.

Cheers,
Johan.
 

bks

Cadet
Joined
May 18, 2021
Messages
2
Is there any downside to using the dock image and the original instructions rather than the current official app. As mentioned by @Johan01 there are not really enough mount points in the official app. Will it be ok to just use the docker and persistent /config mounts?
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
Hi, in my opinon the chia app needs addition mounts next to config and plots. In current configuration the creation of plots happens on the apps pool's drives. If these are (consumer grade) SSDs of NVMe's they will wear out on TBW pretty quickly. Therefore I prefer to have additional mount points for the "-t" en "-2" options so that the creation can take place on dedicted, enterprise grade NVMe drives without affecting the other installed apps.
This is actually a great advice!
Yes, it's something I also worked on with TrueCharts, People really want as many mountpoints as they can fancy and when designing a chart maintainers should keep that in mind...


Is there any downside to using the dock image and the original instructions rather than the current official app. As mentioned by @Johan01 there are not really enough mount points in the official app. Will it be ok to just use the docker and persistent /config mounts?
Only three:
1. It's slightly less convenient
2. App developers can do a bit more things than the "big blue button" allows
3. You don't get configuration updates when the App maintainer updates his App (which might actually be a positive thing, depending on your viewpoint)
 

waqarahmed

iXsystems
iXsystems
Joined
Aug 28, 2019
Messages
136
@Johan01 you should be able to specify additional mounts and environment variables now for official chia application. Please let me know if you run into issues. Thanks
 

bks

Cadet
Joined
May 18, 2021
Messages
2
@waqarahmed I see that there is a new version of the chia app out. How do we upgrade the current version of the official app to pull down this updated code?
 

FreeZM

Dabbler
Joined
Jan 26, 2018
Messages
14
Is there an easy to understandable way to adapt this for TrueNas core? I´m assuming one should use linux-vm (Ubuntu?) and nfs. Is there a nice place to read furthermore - I´m a very noob..., sorry...
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
Is there an easy to understandable way to adapt this for TrueNas core? I´m assuming one should use linux-vm (Ubuntu?) and nfs. Is there a nice place to read furthermore - I´m a very noob..., sorry...
No. None at all.
There is no code in the SCALE version that is anywhere close to CORE plugins.

You could use a VM with k8s/docker-compose, but in that case: don't hijack this thread, because thats a totally different process and NOT noob friendly.
 

Csol

Cadet
Joined
May 27, 2021
Messages
1
trying to find where to just run the harvester instead of the farmer on start
 

Johan01

Dabbler
Joined
May 15, 2021
Messages
18
I would be very pleased to have plotman included in de chia image. It can now be installed through the shell manually but after an edit it has to be reinstalled again. Plotman's plotman.yaml config file should be on a dedicated mounting point /root/.config/plotman, just like chia's root/.chia and /plots mounting points. Hope it can be done :smile:
 

Johan01

Dabbler
Joined
May 15, 2021
Messages
18
I would be very pleased to have plotman included in de chia image. It can now be installed through the shell manually but after an edit it has to be reinstalled again. Plotman's plotman.yaml config file should be on a dedicated mounting point /root/.config/plotman, just like chia's root/.chia and /plots mounting points. Hope it can be done :smile:

Forgot to mention to plotman installation command:
pip install –force-reinstall git+https://github.com/ericaltendorf/plotman@main
 
Top