/chia-plotting-optimizer

The optimizer of the Plotting process in the Chia Network Blockchain.

Primary LanguageC#MIT LicenseMIT

Chia Plotting Optimizer

The optimizer of the Plotting process in the Chia Network Blockchain.

Motivation

Chia plotting process has the 4 stages. The first stage is actively used by the CPU and multi-threading (CPU bound), and the rest are more related to working on the hard disk workloads (IO bound).

An imbalance towards either CPU-bound loads or the other IO-bound loads leads to an inefficient Plotting process, or even throttling CPU- or IO-subsystems.

The Chia Plotting Optimizer project try to avoid imbalance between CPU-bound and IO-bound and in the same time maximize number of parallel plotting processes.

Features

  • Multi-platform: Ubuntu Server 18+ and Windows Server 2019, at least,
  • Flexible configuration,
  • Ability to work in farmer-only mode,
  • Support multiple directories for temporary files and for ready plots,
  • Light-weight and fast C# library.

Installation

Clone from GitHub

git clone git@github.com:codez0mb1e/chia-plotting-optimizer.git

Check that you have installed .NET 5 (if you haven't then it's easy to install).

dotnet --version

How to deploy Chia Farm from Zero?

Running

Update configuration (see Configuration section below), and run run.ps via:

a. Bash:

cd chia-plotting-optimizer/src
./run.ps

b. or Powershell:

Set-Location chia-plotting-optimizer/src
./run.ps

Configuration

  • ChiaGuiVersion: installed Chia Software version
  • farmerKey: you farmer public key for farm-only mode
  • computeResources section:
    • totalProcessorCount: total number of CPUs
    • OsDemandProcessorCount: number of CPU threads allocated for OS
    • ChiaDemandProcessorCount: number of CPU threads allocated for non-plotting Chia processes
    • phase1ProcessorCount: number of CPU threads allocated for CPU-bound (phase 1) phases of plotting
    • phase1MaxCount: maximum number of CPU threads allocated for all CPU-bound phases.
  • plottingDirectories section:
    • logDir: plotting log directory
    • tempPathList: list of directories for temporary files
    • finalPathList: list of directories for ready plots.

Example of configuration for Ubuntu Server (source):

{
  "plottingSettings": {
    "ChiaGuiVersion": "1.1.6",

    "plottingDirectories": {
      "logDir": "/home/<usr_name>/chia-blockchain/logs",
      "tempPathList": [ "/plotdrive1", "/plotdrive2", "/plotdrive3" ],
      "finalPathList": [ "/harvestdrive1", "/harvestdrive2", "/harvestdrive3" ]
    },

    "computeResources": {
      "totalProcessorCount": 16,
      "OsDemandProcessorCount": 1,
      "ChiaDemandProcessorCount": 0,
      "phase1ProcessorCount": 2,
      "phase1MaxCount": 6
    },

    "plottingScriptPath": "scripts/run_plotting.u1804.ps1",
    "farmerKey": "<your_farmer_key>"
  } 
}

References

  1. Official Chia Network.
  2. Chia Network GitHub.
  3. Chia Green Paper.
  4. Deployment Chia Farm from Zero.