Full Chia Plotting Automation in Windows

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!

66 thoughts on “Full Chia Plotting Automation in Windows

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

    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.

      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”?

        1. 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.

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

    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.

      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

        1. 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.

      2. 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?

        1. 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.

      3. 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?

  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.

    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.

  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 ?

    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.

      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 !!! 🙂

      2. 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 ! 🙂

        1. 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.

  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 ?

    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.

  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

    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!

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

    1. Hi Lev, this chance is already done in the latest version of the script. Download from github.

  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

    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.

  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.

    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!

  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

    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.

  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 ?

        1. You can use ” .\chia.exe plots check” to verify plots, but it will use the keys specified in the “config.yaml” file

  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!

    1. Delay parameter is mainly to avoid CPU bottleneck that would occur in Phase 2 of the process. You can check log to see how long Phase 1 takes and adjust the delay parameter to match it. Plotting and storing .plots on faster drives is best for higher overall throughout. Good luck!

  13. Thanks again for this ! I’ve searched for you on discord but couldn’t find you by the way. I joined the “chia blockchain” server, is it the one you mentioned ? if so, my username is “meaning”, come and say hi ! 😉

    The scripts are now running fine since 24h thanks to your temp folder tip!

    My plotting machine is on it’s way, which will add 16 cores to the 6 ones I currently do have. I plan to install Ubuntu on the other machine though. Do you have any scripts available for linux as well ? :p

    I will definitely keep an eye over here as I am quite impatient to see the famous “pool compatible update” of the chia client, and hope your script will be adapted to use the right parameters to build them.

  14. Awesome plugin.
    What if would want to start 14 parallel plots, with 35 minute stagger and I would want to start such process every 10 hours again and again? (since after about 10 hours all the 14 plots should be finished and I dont want to have to start them manually over and over)

    1. You don’t have to do anything once you start it. Each instance will automatically repeat the plotting process for 1000 iterations (if you have latest version) of script, or 100 in earlier versions. It will take a while for it to finish.

  15. Awesome plugin.
    What if would want to start 14 parallel plots, with 35 minute stagger and I would want to start such process every 10 hours again and again? (since after about 10 hours all the 14 plots should be finished and I dont want to have to start them manually over and over) Could that be done via your plugin or somehow via powershell?

  16. Hi, one more question,
    Could you support intermidiate path parameter (and functionality) as in Chia GUI ?
    e.g. $intermediatePath (/optional)

    current parameters:
    [Parameter(Mandatory=$true)][string]$tempPath,
    [Parameter(Mandatory=$true)][string]$destinationPath,
    [int]$delayMin = 0 #default to no delay

    By my testing I believe I would get one more plot per cicle.

    br, Tomaž

    1. Hi Tomaž. What is the intermediate path? Is it “2nd temporary directory”? Can you please provide more context around what it would be used for in your environment. Thank you!

  17. HI Kostya, I’m having issues with modifying the memBuffer and numThreads variables. I can update the variables themselves, but when I run the startPlottingAll cmdlet each window still shows 2 threads and 4096 mem. I’m not sure what I’m doing wrong.

    1. Hi Brian. Looks like you are doing it correct. Make sure you are update the correct file, and save it before starting startPlottingAll.ps. Script does not have any hard-coded values for threads and memory, so I suspect you have multiple copies of startPlotting.ps1 file. As a test, just execute startPlotting.ps1 and see if threads and mem is valid. Good luck!

  18. Hey! I’m trying to read logs with Python but there seems to be something weird going on with the encoding. Do you use special characters to write the logs?

    1. Are you using any python library that expects certain slog structure? There are no special characters, but structure is not based on syslog. Are you able to parse chia debug logs directly?

      1. I figured it out, I’m dumb and was using wrong encoding. Log files were UTF-16, it took me a while to figure out.

    1. Hi Sergey. Script was tested with 1.1.16 on Windows. Make sure to change version variable in startPlotting.ps1 to “1.1.16”. Which line number is the error on? Please send the parameters you use to run script and full error message.

  19. I want to execute a script that plots 5 plots in parallel (with a delay of 30 min) and when all 5 are finished, it starts again until it completes 70 plots in total, how can I do it?

    1. You can set the variable $numberOfPlotsPerInstance = 14 so that each plotting instance will do 14 plots.

  20. Why is the recommended delay 40 min? Shouldn’t it be higher based on the average phase 1 times? My average phase 1 is about 4hs 18min so shoulnd’t it be like 2 hours delay so I don’t have more than 2 plots on phase 1 simul.

    1. When you use more than 1 thread, yo can have more than 1 plot in phase 1 because it’s the only phase that supports more than 1 thread working un parallel

        1. While Phase 1 allows multiple threading, you are limited by CPU in the following threads, so by spreading the start, you avoid bottleneck later in the process.

  21. I’m getting an error were P0 farmer doesn’t start. I get this on main console:

    Starting process for Farmer 0…
    Starting process for Farmer 1…
    Starting process for Farmer 2…
    Starting process for Farmer 3…
    Starting process for Farmer 4…

    But only 4 PS open up. It wasn’t happening before… Any clues as to what might be the issue?

  22. Thanks a lot. It works perfect, just tired of GUI, lost tons of plots. One thing, if it is official, why don’t we see it in Chia GUI

Leave a Reply to Cristiano Cancel reply

Your email address will not be published. Required fields are marked *