Full Chia Plotting Automation in Windows

New Chia crypto-coin could lead to Hard Drive and SSD shortages, price  hikes - Neowin

For the last few weeks, I been plotting Chia Cryptocurrency (https://www.chia.net/) on newly built Windows computer. Initially, this process was labor intensive and unreliable. Over time and a lot of trial and error, I developed and continually refined a number of scripts that made this process more automated.

Chia has a rapidly growing community who helped me along the way. This post will hopefully help others who have been plotting using Chia GUI and can benefit from more automated plotting configuration.

Optimal Disk Configuration

For best throughput (plots/day), consider the following disk arragement:

  • NVMe (1-3) – Fastest possible drives to be used as Temp Storage.
  • SATA SSD (1) – Second fastest drives to be used as intermediate Storage. This is where .plots are created by Chia daemon
  • HDD or External Storage (1+) – Slowest drive to be used as final location. This is where .plots are farmed from.

If this is not possible, consider writing intermediate .plots to NVMe before moving them to HDD drives.

Prerequisites

Scripts developed for:

Source Code

GitHub Logos and Usage · GitHub

Source code is located in https://github.com/kostya12071/chia

Download all scripts as zip.

Script Overview

Scripts provides unattended plotting of concurrent instances of Chia on Windows computers.

Benefits include:

  • Command Line Interface (CLI)
  • Staggered start time (in Minutes)
  • 1 to many concurrent instances
  • Detailed logging
  • Use of intermediary storage to optimize plotting througput with optimized plot copy

StartPlottingAll (startPlottingAll.ps1)

Schedules 1+ instance of Chia plotter with staggered time.

startPlottingAll uses the following parameters:

-tempPath for initial temp room directory. Each instance of plotter will use a sub-folders named P0, P1, etc. Phases 1, 2, 3 happen here.

For optimal performance separate plotting between multiple drives by calling StartPlottingAll once per drive. This should be your fastest drive. (NVMe recommended).

-destinationPath for plot destination. Phase 4 happens here. This should be your next fastest drive (SATA SSD recommended) if you are using it as intermediary storage or slowest drive (SATA HDD, External USB2/3) if this is your final destination (source of farming)

instanceCount is the number of plotting instances to create. Each instance will be started in staggered timeframe if delayMin is specified and use tempPath\sub-folder. By default 1 instance is created.

Recommended concurrently is dependant on number of threads and cores available on your computer as well as number of temp drivers you want to use.

delayMin staggered start delay in Minutes. Plotting will start after the number of minutes specified for each instance. Optimal delay is based on your system performance. Recommended is 40 min for most users. Default is to start immediately.

Examples

Start 3 plotting instances using drive D:\ as temp space and e:\ as destination with 40 min staggered start. This process will use folders D:\P0, D:\P1, D:\P2 as temp folders

.\startPlottingAll.ps1 d:\ e:\ 3 40

Start single plotting instances using drive D:\ as temp space and e:\ as destination immediately. This process will use folders D:\P0 as temp folders

.\startPlottingAll.ps1 d:\ e:\

Full named parameters:

.\startPlottingAll.ps1 -tempPath d:\ -destinationPath e:\ -instanceCount 3 -delayMin 30

StartPlotting (startPlotting.ps1)

Starts a single instance of Chia plotter with 100 sequential plots.

startPlotting uses the following parameters:

-tempPath for initial temp directory. Phases 1, 2, 3 happen here. This should be your fastest drive. (NVMe recommended)

-destinationPath for plot destination. Phase 4 happens here. This should be your next fastest drive (SATA SSD recommended) if you are using it as intermediary storage or slowest drive (SATA HDD, External USB2/3) if this is your final destination (source of farming)

delayMin delay in Minutes. Plotting will start after the number of minutes specified. Optimal delay is based on your system performance. Recommended is 40 min for most users. Default is 5 minutes.

There are a number of parameters that you wylis want to tweak for optimal performance of plotter. The script also requires that you update the version of Chia daemon as it is hard-coded to the latest version available from Chia.net (1.1.5 as of now).

These variables are:


$chiaVersion = "1.1.2" # Update to the installed version of Chia.
$memBuffer = 4*1024 # Maximum memory committed per instance (change based on total memory and number of concurrent processes)
$numThreads = 2 # Number of threads per instance (recommended 2 to 4)

Examples

Start using drive D:\P1\ as temp space and e:\ as destination with 40 min delay. This process will use folders D:\P1 as temp folders

    .\startPlotting.ps1 d:\P1\ e:\ 40

Start single plotting using drived d:\P1\ as temp space and e:\ as destination immediately.

    .\startPlotting.ps1 d:\P1\ e:\ 0

Full named parameters:

    .\startPlotting.ps1 -tempPath d:\ -destinationPath e:\ -delayMin 30

Move Plots between Drives (chia2drive.ps1)

This is a simple powershell script that uses robocopy to continuously monitor and move completed plots from one location (source) to another (destination).

Script checks tempPath every 15 minutes.

tempPath – Location of the .plots to be moved from. this is the storage where Chia deamon writes .plot files.

plotPath – Location of the final destination where plots will be farmed. This is usually the slower drive (USB2/3, HHD)

log – Location of the log file. c:\log\ is the default directory.

Examples

Moves files from D:\ to F:\ drive with log stored in c:\scripts\filelog.log directory.

.\chia2drive.ps1 d:\ f:\ c:\scripts\filelog.log

This script just calls Robocopy with optimized parameters as follows:

robocopy $tempPath $plotPath *.plot /J /MOV /MOT:15 /LOG+:$log /TEE

Reference

There is a wealth of information about Chia plotting and farming process. One of the best post for optimization of plotting process on Windows is by Alex at The Chia Farmer. Be sure to check it out.

Let me know below if you have found the scripts useful, run into an issue or have any recommendations for improvement. Happy Plotting!

37 Comments

  1. Regarding startPlottingAll.ps1, does it only perform 1 plot and then turns off? Or does it know to repeat plotting continuously?

    Like

    1. It repeats for 100 plots which is specified in the ‘-n 100’ parameter on line 57 in startPlotting.ps1. You can change to even larger number to avoid plotting to be stopped after 100 plots per instance.

      Like

      1. I’m looking at your Github page for this. But I cannot find any reference to the -n 100 parameter. Even in older versions in the history of startPlotting.ps1. Did you mean “instanceCount”?

        Like

      2. I updated the script after that comment removing the 100 plot limit. There is no limit going forward. InstanceCount determines number of concurrent plotters to start.

        Like

  2. Hey, thanks so much for the scripts. How can I add as functionality to format temp(1) driver before each plot?

    Like

    1. Hi Joe. Thank you for your feedback. To format the drive, you can replace the line after “# Delete all temporary files” in startPlotting.ps1 with
      Format-Volume -DriveLetter ( $tempPath | Split-Path -Qualifier)
      Since it will DESTROY ALL DATA on the Temp drive, I would recommend you test it very carefully. Why would you want to reformat drive every time?

      Latest script as it remotes all temp files after each plot.

      Like

      1. Hi again.
        The reason for me to format the driver each plot, is because I’m running on a 256GB nvme(which lefts 238gb for use), and sometimes the last temp files are stil there consuming some space and blocking the new plots.
        Thanks so much

        Like

      2. Instead of formatting script removes all temp files from temp folder before starting next plot. This solves the space issue and does not risk accidentally deleting needed files.

        Like

      3. My drives get full always in the 3rd plot. No idea why it works fine for the 2 firsts. That’s why I asked for the format drive script. Do you have any idea what is the problem?

        Like

      4. Each instance requires just over 250 GB of temp space. If you plot 3 at a time, you need at least 1 TB temp drive.

        Like

      5. Actually my SSD is 256GB (which lefts 239GB for use). I’m running 1 plot at a time. What I mean is: the first 2 sequential plots works very well, they finish and move to another HDD. But in the middle of 3rd plot process, the SSD runs out of space and the plot process stops. Why’s that?

        Like

      6. Thank you for clarifying. Check and turn off recycling bin for this drive, if enabled.

        Like

  3. hello great scripts is there any way i can use the flags
    -f [farmer pk]
    -p [pool pk]

    i have separate machines and i don’t want my private key to be around different machines.
    is there any way, that you can add an option to plot with the Farmer Public Key and the Pool Public Key ?

    thank you very much for your scripts.

    Like

    1. Thank you for feedback. I’ll consider adding the option for passing keys. Is this something you want to pass via command line argument of store in the script file? In the meantime, you can modify “&$chiaDeamon plots create ” line in startPlotting.ps1 adding “-f” and “-p” options.

      Like

  4. thank you !

    Just to be sure, I have a 6 cores cpu, 64 gig ram, 1*2tb nvme, and the final folders are 6*14tb hdds.

    I just ran this :

    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath i:\ -delayMin 30
    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath j:\ -delayMin 60
    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath k:\ -delayMin 90
    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath l:\ -delayMin 120
    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath n:\ -delayMin 150
    .\startPlottingAll.ps1 -tempPath g:\ -destinationPath m:\ -delayMin 180

    I guess this will do the job right ? plotting 120 plots per drive (which sould be fine to fit the 12.7 available tb’s on each drive)

    any changes you would suggest ?

    Like

    1. That would be good; Few changes I would suggest: first script should start with -delayMin 0 and then go from there. Also, set threads to 2 and memory to 4 Gb if it’s different as it might help you with overall performance. since you have 2Tb drive, you should be fine with plotting 6 concurrent instances (250 gb * 6 < 2 tb) but keep an eye on available space on NVMe.

      I'm releasing new script in few minutes that removes 100 plots limit and splits logging into multiple files.

      Like

      1. I actually did the math differently in the end.

        I used the other script and did put 120 as value. So it will start creating 120 plots per drive.

        I created one command line per hard drive I have plugged, which means I now do have 6 powershell instances running.

        first one looks like :
        StartPlotting.ps1 -temppath g:\ destinationpath i:\ -delayMin 0

        then the second one :
        StartPlotting.ps1 -temppath g:\ destinationpath i:\ -delayMin 30

        etc.

        I ran each of these scripts at the same time, which means they wil sequentially start to create plots on each drive, but the second command will start with 30 min delay, the third with 60 min delay, etc.

        It seems to work so far ! I’ve kept the 4gig and 2 threads per default.

        Not sure what your new release is doing ? split logging into multiple files ? can you explain ?

        thanks again !!! 🙂

        Like

      2. New release creates separate .log file for each plot. By default they are in c:\logs\ folder.

        Like

      3. I’m really sorry to ask but I ran 6 jobs in parallel running the .\startPlotting.ps1 script 6 times in parallel, with a 30 additional delay per script. But it turned out to display me a lot of errors specifying the temp files are in use.

        Could you please tell me how to achieve what I want to do ? Today I will get a new cpu, and will have the capacity to run 14 plots in parallel (5950x, 14cores, 64gig ram, 2*2To nvme).

        Idea is really to plot on the 6 hdd’s I currently plugged using usb (letter I: to N:) and using my 2 nvme drives as temp folders (Y: and Z:)

        Can you make me a big favor and share the right command you would launch to get thi running without errors ?

        Are you hanging on discord, IRC, telegram or anywhere else ?

        Thanks again ! 🙂

        Like

      4. Hi Meaning,

        You get temp error if tempFolder for each run parallel instance is the same. Your script was good, except change source to a unique path. Sorry i didn’t notice it earlier.
        .\startPlottingAll.ps1 -tempPath g:\P0\ -destinationPath i:\ -delayMin 30
        .\startPlottingAll.ps1 -tempPath g:\P1\ -destinationPath f:\ -delayMin 60
        .\startPlottingAll.ps1 -tempPath g:\P2\ -destinationPath g:\ -delayMin 90

        You can find me on Discord Chia Coin channel as well. My username is Kostya.

        Like

  5. Also another question. I guess this is calling the official chia mining client to build the plots, right ?

    Will it keep working when new plots will need to be created to be pool compatible ?

    Like

    1. Yes, it is calling official client. As new versions get released, I will update the script. Make sure you get the latest versions from github.

      Like

  6. when i try to execution the powershell script , nothing to happen
    also when i try execution manually , by hand , it is nothing to happen too
    my powershell version is 7

    Like

    1. Had same issue until I figured out that you need to run the script inside the folder you saved the script. My case it is in C:\Apps\ChiaScript so I went to this path using powershell console to run the script, and now it’s running.

      Also adjust the Chia App version, in the script it was 1.1.5 but in my case I’m running 1.1.4 and it will be adjusted inside the script to use the right executable path.

      Thank you Kostya!

      Like

  7. Dear Kostya, please advice how to split log files by each plot. Just for one plot make 1 logfile

    Like

  8. startplottingall.ps1 must be started in chia daemon folder?
    i set the ps1 file by notepad like this

    #>
    param (
    [Parameter(Mandatory=$true)][string]$tempPath,D:/
    [Parameter(Mandatory=$true)][string]$destinationPath,F:/
    [int]$instanceCount = 3,
    [int]$delayMin = 30
    )

    d:/ is nvme, f:/ is hdd

    but when i try to exe script , powershell window shut down instantly

    Like

    1. Hi. No, you can put .ps1 files in any folder on your computer. Start PowerShell console first, then change to script directory and execute the script. See earlier comment for more details around running PowerShell. You do not need to edit startPlottingAll.ps1. Instead, you should pass parameters to it.

      Like

  9. Hello, thank you very much for providing such a great script.

    But I still don’t know how to execute this script.

    Do I just need to edit the script with the note pad and run it with a power shell?

    I have two NVme and would like to have three parallel plotting each.

    Edit the startplottingall.ps1 script to the notepad and temporarily nvme
    We’ve assigned the HDD to the final path, and set it to 3, 30 minutes of delay at the same time.

    However, if you run the script into a power shell, it will exit shell.

    I’d like to ask for your help.

    Like

    1. Hi. Thank you for feedback.

      You can run PowerShell from Start (Windows) menu by typing “PowerShell” and click Run as Administrator. Change execution Policy (one time) to allow local scripts to be executed without being signed: type “Set-ExecutionPolicy RemoteSigned” and Press Y to confirm.

      To run script, change to the folder where yours scripts are located using “cd ” command. Then execute the script using “.\startPlottingAll.ps1 d:\ e:\ 3 30” replacing “d” with your NVMe drive and E with your HDD.

      For a quick guide on how to start and run powershell check out https://adamtheautomator.com/run-powershell-script/ or reply here with any questions.

      Good luck!

      Like

  10. hello Kostya and thanks a lot for the great script.
    is there a command to automatically stop sequel of e.g. 100 after the current is completed?
    all the best

    Like

    1. Not really. I found no reason to have such a parameter. You can always cancel the process by pressing Cntr+C or just closing the terminal window.

      Like

  11. Hi Konstantin,
    Thank you for the scripts ! Two questions :

    1. Do you have the link for the “official” Discord channel ? I do not find you on “Chia Blockcoin” channel.
    2. On PowerShell, the pool and farmer public key differ from the GUI “reward” adress, is it normal ?

    Like

  12. Hi,
    I followed your “Optimal Disk Configuration” mentioning “SATA SSD (1) – Second fastest drives to be used as intermediate Storage”.
    – Could this shorten the proccess (delay parameter), how much?
    – How can I set it up with your latest sript, is there a path parameter?

    (I am testing this just now ower GUI)
    Thanks!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s