Skip to content

aelfakih/Manage-Chia-Farm

Repository files navigation

Manage-Chia-Farm

Manage your Chia farm like a Pro!

NOTE: Manage-Chia-Farm(MCF) was developed and tested with Python 3.9 on Windows 10

Main Menu

Why Manage-Chia-Farm?

While chia provides farmers with the ability to validate plots and to detect duplicates, the GUI only provides an error message and does allow farmers ways to remedy the issues, or to intelligently decide which is the best option to take, so that the farm maximizes its compactness. MCF aims to bridge that gap by providing the tools to analyze what plots are valid, invalid, which files are sitting in the plot directories eating up space that can be deleted. Give farmers the flexibility to exclude which file extensions to ignore from the analysis.

When Chia started, many farmers started creating plots that were commonly referred to as Old-Gangster (OG)s plots, which were used for Solo farming, those were upgraded to NFT plots as of Version 1.2.0 and could be used for Pool farming. As of version 1.4 of MCF farmers can point the application at a source location, and it would then import the incoming plots over existing OGs one-file-at-a-time.

MCF is designed to run in the terminal on purpose, to make it more interoperable and to require less dependencies. I hope you enjoy using it, and feel free to reach out if you encounter a bug that you would like me to look at.

-- Adonis

1. Features

Manage-Chia-Farm (MCF) is a menu-driven-program, which allows farmers to move, migrate, overwrite, verify and manage OG and NFT plots with a chia farm. It speeds up the process of managing a farm and minimizes errors due to manual data entry.

MCF is designed to handle the management of thousands of plots in chia farms and supports the following features:

Main Menu

1.1 Farm Management

  • Scan and Verify Plot Directories and Plots
    • Find non-plots: Search in each of the farm folders, look for files that do not end with .plot extension and prompt manager to delete the files to clear space.
    • Find duplicate plots: Search the farm for duplicate file names and prompt manager to delete duplicates and maintain one copy to clear up space (it has logic to remove duplicates with minimal impact on compactness of farm).
    • Verify Plot Directories and Plots This is an exhaustive process that tests and verifies all plots in the farm, and collects data along the way to make farm management easier for larger farms.
      Data collected is stored locally in a SQLite DB called chia-farm-stats.db. The program:
      • Checks that directory plots are online so that farmer can take action.
      • Verifies plots are valid for the installed chia instance.
      • Classifies the plots as NFT or OG.
      • Saves/Updates their location and size in GiB.
  • Move plots: Allows farmer to select source location from a list and search for plots to move. It also helps farmer in understanding how much space is available at a given destination. This function allows the consolidation of plots into a location as you upgrade your drives or move plots from plotting to farming. When you select to move a plot, the source files can be:
    • Kept at the source location.
    • Renamed (add an ".imported" extenstion)
    • or deleted NOTE that if you ctrl-C out of manage-chia-farm while executing a move plot command, it will apply the selected action on source file -- if you do not want to lose any plots, always use the imported option then manually delete the source files)
  • Overwrite OG Plots: Allow farmers to automatically overwrite OGs when importing NFTs into farm without having to search for them or move them around. This is an important feature for farmers that have OG plots and are migrating into an all NFT plot configuration.
  • Resolve Issues Found: This scans the data found during the Verify Plot Directories and Plots and give farmer the option to fix chia configuration file, and remove invalid plots. (By default this option is not visible in menu option, until an issue is detected after a farm/plots scan)
  • Synchronize Chia Forks: Keep the plot directories configuration of all chia-forks (https://xchforks.com/) installed on you machine in sync with your main Chia configuration. As of version 1.6, a new variable is available in MCF's config.yaml to control which forks you want to scan and update.

Sync Chia Forks

1.2 Reporting

  • Show Available Space: This function scans the database and reports the available number of plots that can be stored in mounted plot directories (assumes k32 plot size 101.5 GiB)

  • Show Farm bar Graph Usage: This function scans the database and reports how the space is being used. It lists all the mount points and shows total size, how much it is used and free reported size in GiB.

Show Available Space

Show Used Space

1.3 Multiple Volume Mount Support

MCF detects these types of drive mounts and returns space statistics:

  • Letter mounted drives (i.e. D:, E:)
  • Folder mounted drives In windows you can mount iscsi and usb drives as directories such as c:\mnt\drive1 this allows the user not be limited to D-Z drive naming.
  • Network drives (i.e. //server/mount_point) NAS mounted drives (NFS, Samba, etc..) can be recognized an scanned for plots.

Three mount styles

2. Installation (Git)

Pre-requisites

  • Python 3.9+
  • Git

Open a terminal in windows and download the utility from Github.com

git clone https://github.com/aelfakih/Manage-Chia-Farm

Change directory into Manage-Chia-Farm

cd Manage-Chia-Farm

Load required libraries using the following command

pip install -r .\requirements.txt

2.1 Upgrading from previous versions (Git)

If you installed the project as described below, you can get the latest code changes by executing the following command in the Manage-Chia-Farm directory

git pull origin master

3. Configuration

Before being able to start using the utility, we need to configure it by editing the config.yaml. Copy the default config.yaml

cd Manage-Chia-Farm

copy config.yaml.default config.yaml

Open the configuration file and enter the path to chia's config.yaml into the chia_config_file variable. (the next command is something that you might use. You can use your favorite editor)

PS C:\Users\USERNAME\Manage-Chia-Farm> notepad.exe config.yaml

chia_config_file

Edit the chia_config_file variable. The format is usually something like this (change the USERNAME to match your path):

# location of Chia's configuration file. It is used to navigate the plots directories
chia_config_file: C:\Users\USERNAME\.chia\mainnet\config\config.yaml

chia_binary

Edit the chia_binary variable. The format is usually something like this (change the USERNAME and VERSION to match your path):

# location of chia executable, used when importing plots to verify that they belong to this farm
chia_binary: C:\Users\USERNAME\AppData\Local\chia-blockchain\app-VERSION\resources\app.asar.unpacked\daemon\chia.exe

verbose

You can control the amount of logging needed for your setup. To turn logging on, set verbose to True to control the amount of reporting collected you can set verbose_level to ERROR, INFO or DEBUG, where ERROR shows the least amount of messages (ctitical to funcionality) and DEBUG shows the most, so you can see what the application is doing and verify expected behaviour.

# when verbose is true, the program ouputs extra information into log\audit.log
verbose: false

verbose_level

# what level of logging do you want to show, by default it is ERROR
# Available options are ERROR, INFO, DEBUG
verbose_level: ERROR

database_location (Optional)

Store the SQLite database at a different location than the default ".\db"

# Where do you want to store the database.  If not defined, it is stored in local directory "db"
# database_location: db
database_location: C:\path\to\database\

ignore_extensions (Optional)

Ignore specific file extensions when executing the Find non-plots, so that you can keep files that you want to keep in farm. Good examples are .plot.tmp files if running MCF on a plotter machine and you do not want to accidentaly delete the .tmp files

# Ignore the following file extensions when looking for non-plots for deletion
# NOTE! all extensions MUST start with a (.) dot. for example .txt , .plot.tmp
ignore_extensions:
 - .plot.tmp

default_action_after_replacing_ogs (Optional)

You can overwrite what happens after an OG import occurs. By default, the original NFT is renamed .imported, so that it can be cleaned up later after checking that everything went well.

# what do you want to be the default action on the original plot after replacing an OG plot?
# rename -- adds suffix imported to original plot
# delete -- delete original plot
# keep -- keep  original plot
# default_action_after_replacing_ogs: rename

chia_forks (Optional):

Chia farmers can farm other green coins with the same farm (chia forks, see https://xchforks.com/ for a comprehensive list). MCF makes farming other coins very easy. Just install the chia forks of your choice and make sure they are using the same keys to be able to use the same plots. Then configure the chia_forks value and MCF will synchronize them to your main chia farm plot directories configuration settings. (Available as of version 1.6)

# Synchronize your farm's Chia plot_directory with specified forks installed on this machine
chia_forks:
 - C:\Users\USERNAME\.chaingreen
 - C:\Users\USERNAME\.flax
 - C:\Users\USERNAME\.flora
 - C:\Users\USERNAME\.goji-blockchain
 - C:\Users\USERNAME\.hddcoin
 - C:\Users\USERNAME\.seno2
 - C:\Users\USERNAME\.spare-blockchain

do_no_import_into_this_plot_directory (Optional):

Control which drives are available to import/move plots into farm through the config file. List the plot directories of the drives that you do not want to be modified/changed or there are issues when trying to make changes. I created this feature because I had an issue with a RAID device that was incorrectly reporting back more space to Windows. And there was another device that reported space but whenever a plot was copied to the space it was corrupted. (The decision was to mark the rest of the device unusable for plot storage and hide it from MCF)

# List the plot directories that you want to stop adding plots to (they will not show in menus)
#do_no_import_into_this_plot_directory:
# - C:\mnt\DISK01
# - C:\mnt\DISK04
# - C:\mnt\BOX5\001

4. Usage

To run this program, execute the following command

python manage-chia-farm.py

Example Output

Import Plots into Farm

Import Plots into Farm

Verify Plot Directories and Plots

Verify Plot Directories and Plots

How to Support

If you enjoy this program and want to part with some Mojos, feel free to send it to

XCH: xch12gp5cmdwlrpdpvza8ttvjeu5ml76ytn7v94ujwzpwwvff6n6h3lsgxn65h

Windows 10 Tips and Tricks

Labeling Drives

Avoid serializing your drives from 1 to N. Instead, encapsulate them inside the serialized number of the JBOD. Consider you have 20 JBODs and each one holds 10 drives. Instead of labeling them 1-20, label them BOX1-1..BOX11-10 .. BOX20-1..BOX20-20

This approach, makes it easier to connect what you see happening on MCF or other system error messages.

Mounting Drives

While the first instincts is to mount drives using letters on Windows, you soon will run out of drive letters and windows will from time to time switch the letter it assigns drives, which may affect farmers that use subdirectory structures (another hint DO NOT use subdirectories yo do not need them).

So create a directory structure in the root directory (I use "/mnt") specifically designed to mount drives, and it would mirror the drive labels.

Labeling an Mounting Drives

About

Manage-Chia-Farm (MCF) is a menu-driven-program, written in python for windows 10, which allows Chia crypto farmers to move, migrate, overwrite, verify and manage OG and NFT plots.

Resources

License

Stars

Watchers

Forks