Вы находитесь на странице: 1из 11

18.05.

2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Чиа фермер
Опыт фермера по выращиванию XCH из блокчейна Chia.

Почему все переходят на NV


Переводите серверы на NVME? Вот всё, что вам

Kingston Technology

Печать с помощью PowerShell в Windows

Окно PowerShell

Windows PowerShell превратилась в отличный инструмент для управления сценариями и их выполнения на


компьютерах с Windows. Он встроен в каждую установку Windows 10. В этом посте мы узнаем, как запускать
плоттеры с помощью PowerShell. У запуска плоттеров в PowerShell есть несколько преимуществ:

1. Построение графиков не привязано к графическому интерфейсу пользователя Chia . Если в клиенте Chia происходит
сбой или ошибка, ваш плоттер продолжит работать, пока клиент восстанавливается.
2. Каждое окно PowerShell - это один плоттер . Если вы планируете выполнять черчение параллельно (запускать
несколько плоттеров на одной машине), то это идеальный способ визуально увидеть, сколько плоттеров работает и
как далеко они продвинулись.
3. Вы можете отменить очередь плоттера после текущего графика. У каждого плоттера своя длина очереди в
PowerShell. То, что я обнаружил случайно, вы можете щелкнуть в окне PowerShell и нажать CTRL-C. Ничто не
подтвердит ключевую команду, но в конце текущего графика плоттер прервет очередь.
4. Вы можете создать сценарий PowerShell для запуска всех ваших плоттеров. Возможно, лучшая функция, вы можете
запустить сценарий, и все ваши плоттеры будут запущены со своими настройками в своих индивидуальных окнах.
Идеально.

Прежде чем использовать PowerShell, выполните несколько домашних правил, чтобы вы не попали в ловушки,
которые есть у меня. Выполните следующие шаги:

1. Откройте Powershell, нажав клавишу Windows и набрав «PowerShell».


2. Когда откроется окно PS, щелкните в левом верхнем углу окна, чтобы открыть меню. В этом меню нажмите
«Свойства».
3. В новом окне снимите флажок «Режим QuickEdit». Обычно эта функция удобна, когда вы хотите выделить текст в
окне и скопировать его в другое место. Но у него есть плохой побочный эффект, заключающийся в приостановке
всего, что выполняется в окне. Это плохо, если плоттер пишет, и вы случайно щелкнете по окну, перетаскивая его.

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 1/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Отключение режима QuickEdit предотвращает это. Если вы хотите выделить текст в будущем, просто щелкните
правой кнопкой мыши в окне PS и выберите «Отметить».
4. Затем щелкните вкладку «Макет». Найдите поле «Высота». Это то, на сколько вам нужно прокрутить назад. Мне
нравится тонна прокрутки назад, поэтому я максимизирую это значение до 9999. Это сделано для того, чтобы вы
могли просматривать информацию о ходе выполнения многих графиков, чтобы увидеть время.
5. По завершении нажмите кнопку ОК.
6. Если вы когда-либо планируете запускать собственные сценарии PowerShell, введите команду ниже в окне
PowerShell администратора, чтобы она была включена:

set-executionpolicy remotesigned

Теперь, когда PowerShell настроен так, чтобы вы не допустили моей ужасной ошибки, мы можем приступить к
тому, как запустить плоттер. В окне PS введите следующую команду:

cd "C:\Users\<username>\AppData\Local\chia-blockchain\app-1.0.5\resources\app.asar.unpacked\daemon\"

В приведенной выше команде обратите внимание на два места, выделенные жирным шрифтом. «<Имя
пользователя>» необходимо заменить на ВАШЕ имя пользователя на вашем компьютере. Затем «app-1.0.5» будет
заменен версией chia, которую вы используете. На данный момент последняя версия 1.0.5. Но так будет не всегда.

После того, как вы измените каталоги (cd) на эту папку, введите следующую команду, чтобы запустить плоттер:

.\chia.exe plots create -k 32 -b 3389 -u 128 -r 2 -t E:\temp -d D:\plot -n 1

Здесь много информации, поэтому я разобью ее:

Создание графиков. \ chia.exe - это самоочевидно. Я хочу, чтобы чиа создала сюжет.
-k 32 - это размер графика, который вы хотите создать. K = 32 - минимальный размер участка, который считается
действительным в сети Chia. Кроме того, он самый быстрый в создании. Вы можете уменьшить значение K, но эти
графики недействительны в сети.
-b 3389 – This is the amount of ram you want to allocate to the plotter. It does not use all this ram at once, its just the
limit. But, windows will preallocate this amount and call it “committed” which might push other applications to virtual
memory on disk if committed is maxed. 3389 is the perfect amount if you are using 2 threads. I have found that 4 threads
requires a minimum of 3408; 6 threads 3416; 8 threads 3424.
-u 128 – This is the bucket size. Essentially its how many pieces you want the workload to be divided in. If you change
this to 64, then you have to double the ram amount. From my experience, there is no change in plot speed messing with
this number. So leave it at 128.
-r 2 – This is the number of threads you want for the plotter. The plotter works in four phases. This number only affects
phase 1 of a plot. Phase 2, 3, and 4 are all single threaded. In my testing, I saw a 30 minute speed improvement from
using 2 threads to 4 threads. Then, I only saw a 5 minute improvement from 4 threads to 6 threads. There is diminishing
returns de nitely. Always try to use at least 2 though, because 1 thread is really slow.
–t E:\temp – This is your temporary directory. Remember to pick a fast drive here.
-d D:\plot – This is your nal directory. This can be an external usb drive or another type of fat spinny hard drive.
-n 1 – Finally this is your queue. How many plots do you want to make with these settings? Remember, you can set any
number here and then stop it with CTRL-C.
Since we are plotting on the same machine as the farmer, the keys needed to generate the plots are automatically
brought in. So we don’t need to specify those here.

That’s pretty much it for the PowerShell command. Executing this command will start the plotter on its journey and it will
print its progress in the window. Next is the scripting part. Below I have placed the script I use on my machine. Copy and
paste this script into notepad and save the file as plotterscript.ps1, while selecting “All Files” for the file type:

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 2/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Notepad “Save As..” Window

Here is the script. Copy/paste the invoke-expression line for each plotter you wish to start :

#Begin Script
############Plotters for Temp Drive###############
invoke-expression 'cmd /c start powershell -NoExit -Command {cd "C:\Users\<yourusername>\AppData\Local\chia-
blockchain\app-1.0.5\resources\app.asar.unpacked\daemon\";$host.ui.RawUI.WindowTitle = "t1p1"; start-sleep 0
; .\chia.exe plots create -k 32 -b 3389 -u 128 -r 2 -t E:\temp -d D:\plot -n 1 ;Read-Host -Prompt "press
enter to exit"}'

Lets breakdown the script above. You will see semicolons in the script above. These separate each command of the new
PowerShell window.

invoke-expression ‘cmd /c start powershell -NoExit – This rst part is what tells PowerShell to open another PowerShell
window. The -NoExit ag is to not close the window when complete. Just in case you want to review the results.
-Command {cd C:\Users\<yourusername>\AppData\Local\chia-blockchain\app-
1.0.5\resources\app.asar.unpacked\daemon\ – The -Command here is the commands we want to pass to the new
PowerShell window that opens up.
$host.ui.RawUI.WindowTitle = “t1p1” – This command allows you to rename the title of the PowerShell window. This is
to keep track which window it is. Here, the name scheme I’m using is tempdrive 1, plotter 1. Since I have two plotter
drives.
start-sleep 0 – This next command is critical. When running plots in parallel you need to space them out a bit so that all
of them are not trying to write to the nal directory at the same time. If using an external drive, this causes a major
headache. The value here is in seconds. For example, if you want an hour between plotters, it would be 0 for the rst
plotter, 3600 for the second plotter, 7200 for the third, etc.
.\chia.exe plots create -k 32 -b 3389 -u 128 -r 2 -t E:\temp -d D:\plot -n 1 – This is the Chia plotter command that was
explained above. Update this to your settings.
Read-Host -Prompt “press enter to exit” – This was a hold-me-over from a previous version of the script incase for some
reason the “-NoExit ag didn’t work.

There you have it, this should provide you with enough information in order to create and tweak your own scripts in order
to maximize your plotters on your machine without having to worry about Chia Client issues.

With the file saved, all you need to execute it is to right click the file and select “Run with PowerShell”.

Share this:

 Twitter  Facebook

Like this:

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 3/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Loading...

29 thoughts on “Plotting with PowerShell on Windows”

Pingback: Plotting on Multiple Windows Computers – The Chia Farmer

Pingback: How to Move A Chia Farm to Another PC – The Chia Farmer

barabashko
April 26, 2021 at 8:14 pm

Alex, may i take a little futher? Is it possible via PS parse when “Starting phase 2/4: Backpropagation into tmp les…” appears
in the windows and only that kick next plot? It would be much precise than timing offset option.

Loading...

Alex Armstrong
April 27, 2021 at 7:22 am

Yes, This is possible and would be more precise. But at that point, you are developing something more than a simple script.
If you do this or nd this somewhere, let me know.

Loading...

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 4/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Chuck
April 26, 2021 at 11:53 pm

Hi Alex could you please explain the last part of the command — Read-Host -Prompt “press enter to exit”

I just started my rst round of plots (8 in parallel) using your script but about an hour in I hit something that stopped them
all, and then the “press enter to exit” message was displayed.

Any ideas on what I could have done?

Thanks!

Loading...

James
April 27, 2021 at 5:45 pm

Hi Alex, thank you for this great guide, just a quick question though, is there any simple way it can be changed so instead of
waiting for a keypress after creating the plot it simply loops and does it again (I’m assuming this would allow it to then run
until the target drive is full of plots).

Loading...

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 5/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Alex Armstrong
April 27, 2021 at 5:51 pm

Hi James, I suppose there could be a way to loop this, but wouldn’t it be better to adjust the “-n” value? This way, it will
keep plotting up to that number. And, if you ever need to stop it, press CTRL-C and it will stop after the current plot is done.

Loading...

James
April 28, 2021 at 3:00 pm

Ahh that is a much better idea, thank you very much.

Loading...

charpman
April 28, 2021 at 5:52 pm

This is great Alex! How would I add logging so that the output of the windows goes to individual log les? Easier to parse
through for stats and timings information.

Loading...

Alex Armstrong
April 28, 2021 at 8:56 pm

Hi charpman, there are many ways to pipe output to log les. I haven’t looked that much into it, but if you come across a
good method share it here and I can add it to the post.

Loading...

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 6/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Liraz
April 29, 2021 at 7:28 am

I use -redirectstandardoutput in order to pipe out the log.


Example of a powershell command:

start-process ./chia.exe -redirectstandardoutput C:\Temp\Chia.Logs\log.20210428.0927.log -argumentlist “plots create -k 32 -b


4000 -u 128 -r 4 -t E:\Temp -d D:\Plot -n 1”

For now I start the plots manually, so “20210428.092700” is a manual timestamp.

Loading...

platypus
April 29, 2021 at 1:01 pm

He Alex, thanks for the great post. I have a Powershell Newbie Question:
So if I wanted to Powershell Plots in Parallels (let’s say 3 sets in Parallel), do I just make 3 copies of the code in one text le?
Obviously change the naming and delay of each set, and separate each set by a space (enter key).

Loading...

Alex Armstrong
April 29, 2021 at 7:38 pm

Hi Platypus check out my post named Optimizing Plotters in Windows. I placed my script there. Thanks.

Loading...

Max
May 2, 2021 at 5:06 pm

Hello Alex, thank you for your guides!

Could you please explain me the command “start-sleep”. So in my case, I copy-pasted your script and saved three les with
different titles of course, so i stared rst, waited an hour and started second one manually, waited an hour and started third
script. What exactly the command “start-sleep” does in my case?

Loading...

Alex Armstrong
May 2, 2021 at 8:15 pm

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 7/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Hi Max, The start-sleep is the actual wait command. So you don’t actually have to wait to launch the next one manually.
Just launch them all at once and the wait is built in.

Loading...

Tomibeg
May 2, 2021 at 6:12 pm

Hello, thanks for this post! Could I ask about “Quick edit” and etc.. I’ve did what you said (also tried not only with “Properties”,
but with “Defaults”), but when I execute script – it opens all PS windows without changed settings (so it has different font
size, QuickEdit enabled , etc.) – it looks like script opens versions of PS with some different pro le con g. Could you tell
please, how to save this properties con g and make script to be able create new PS windows with these settings. Thanks
again!!

Loading...

Alex Armstrong
May 2, 2021 at 8:18 pm

Hi Tomibeg, Thanks for your comment. This is interesting. You’re not running the script as admin are you? Probably not, but
its worth to ask. What you might have to do then is in one of the open powershell windows, you change the default settings
on one of those and save it.

Loading...

Tomibeg
May 3, 2021 at 12:23 pm

Thanks, Alex! For some reason even with Administrator rights it doesn’t save pro le for windows created by script
(regular windows which I manually create are opened with saved settings). But I think I found solution – I created script
just to open custom PS window without chia, then changed con g settings inside this window, and then it looks like all
my new windows created by scripts also use these new settings. Looks like in my case PS uses independent con g for
script-opened instances.

Loading...

Raffy
May 3, 2021 at 6:09 am

Thanks for this tutorial Alex. I have a question for you. I wanted to continuously plot to the nal drive 52 time, is there a way
to iterate on the “start-sleep” to space the delay an hour between each plot instead of manually lling out the different delay
time 52 times?

Thanks

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 8/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Loading...

Alex Armstrong
May 3, 2021 at 7:26 pm

Hi Raffy, Thank you for your comment. If you want to plot 52 times you can set ‘-n’ to 52. This will make a queue of 52 plots.

Loading...

Zach
May 3, 2021 at 7:43 am

Also your initial run isn’t representative of future runs because the rst plot has no competition for resources until the second
plot runs, I gure out my overall time then take a smidge away from initial plots and add to later plots on the rst run to get
the spacing more equal.

Loading...

Raph
May 8, 2021 at 8:54 am

Hello Alex, thanks for that great tutorial!! It helped me to improve mine.

Below is few things that I added in case that can help you or other people

Add log le:

$Date = get-date -uformat “%Y%m%d%H%m”


This is to create a date, then we can use $Date later to name our log le.

| tee C:\Users\USER\Desktop\Logs\970_PRO_1_$date.log
This creates the log le with date integrated, like this for example : 970_PRO_1_202105081205.log

—–

Add buzer:

[console]::beep(800,500) ; start-sleep 300 ; [console]::beep(800,500)


This will buzz 1 then sleep 5 mins then buzz again, you can add as many as you wish
I added that to the rst plot line, so I now when it’s done and I can launch a new ps1 le if needed.
Or you can add it to the latest one and you will know when latest plot is done.

—–

At the end this is what it looks like with a exemple of 2 plots:

invoke-expression ‘cmd /c start powershell -NoExit -Command {cd C:\Users\USER\AppData\Local\chia-blockchain\app-


1.1.X\resources\app.asar.unpacked\daemon\;$host.ui.RawUI.WindowTitle = “970 PRO 1”; start-sleep 0 ; $Date = get-date -
uformat “%Y%m%d%H%m” ; .\chia.exe plots create -k 32 -b 6750 -r 4 -u 128 -n 1 -f FARM KEY -p POOL KEY -t Z:\ -d K:\ | tee
C:\Users\USER\Desktop\Logs\plot_970_PRO_1_$date.log ; [console]::beep(800,500) ; start-sleep 300 ; [console]::beep(800,500)
; Read-Host -Prompt “press enter to exit”}’

invoke-expression ‘cmd /c start powershell -NoExit -Command {cd C:\Users\USER\AppData\Local\chia-blockchain\app-


1.1.X\resources\app.asar.unpacked\daemon\;$host.ui.RawUI.WindowTitle = “970 PRO 2”; start-sleep 7200 ; $Date = get-date -
uformat “%Y%m%d%H%m” ; .\chia.exe plots create -k 32 -b 6750 -r 4 -u 128 -n 5 -f FARM KEY -p POOL KEY -t Z:\ -d K:\ | tee
C:\Users\USER\Desktop\Logs\plot_970_PRO_2_$date.log ; Read-Host -Prompt “press enter to exit”}’

Note that I added -f FARM KEY & -p POOL KEY because this computer is a plotter only.

Raph

Loading...

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 9/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

Raph
May 8, 2021 at 1:42 pm

Hello Alex, thanks for that great tutorial!! It helped me to improve mine.

Below is few things that I added in case that can help you or other people

Add log le:

$Date = get-date -uformat “%Y%m%d%H%m”


This is to create a date, then we can use $Date later to name our log le.

| tee C:\Users\USER\Desktop\Logs\970_PRO_1_$date.log
This creates the log le with date integrated, like this for example : 970_PRO_1_202105081205.log

—–

Add buzer:

[console]::beep(800,500) ; start-sleep 300 ; [console]::beep(800,500)


This will buzz 1 then sleep 5 mins then buzz again, you can add as many as you wish
I added that to the rst plot line, so I know when it’s done and I can launch a new ps1 le if needed.
Or you can add it to the latest one and you will know when latest plot is done.

—–

At the end this is what it looks like with an exemple of 2 plots:

invoke-expression ‘cmd /c start powershell -NoExit -Command {cd C:\Users\USER\AppData\Local\chia-blockchain\app-


1.1.X\resources\app.asar.unpacked\daemon\;$host.ui.RawUI.WindowTitle = “970 PRO 1”; start-sleep 0 ; $Date = get-date -
uformat “%Y%m%d%H%m” ; .\chia.exe plots create -k 32 -b 6750 -r 4 -u 128 -n 1 -f FARM KEY -p POOL KEY -t Z:\ -d K:\ | tee
C:\Users\USER\Desktop\Logs\plot_970_PRO_1_$date.log ; [console]::beep(800,500) ; start-sleep 300 ; [console]::beep(800,500)
; Read-Host -Prompt “press enter to exit”}’

invoke-expression ‘cmd /c start powershell -NoExit -Command {cd C:\Users\USER\AppData\Local\chia-blockchain\app-


1.1.X\resources\app.asar.unpacked\daemon\;$host.ui.RawUI.WindowTitle = “970 PRO 2”; start-sleep 7200 ; $Date = get-date -
uformat “%Y%m%d%H%m” ; .\chia.exe plots create -k 32 -b 6750 -r 4 -u 128 -n 5 -f FARM KEY -p POOL KEY -t Z:\ -d K:\ | tee
C:\Users\USER\Desktop\Logs\plot_970_PRO_2_$date.log ; Read-Host -Prompt “press enter to exit”}’

I added -f FARM KEY & -p POOL KEY because this computer is a plotter only.

Raph

Loading...

Rafa
May 9, 2021 at 7:06 pm

Hi Alex,

Thank you very much for your time and effort to help us.

I have checked all my plots inside a HDD with command “.chia plots check” on Windows PowerShell and all of them are OK
and not duplicatted, but when I connect them to farm on my iMac, there are 4 plots that doesn’t appear on Local Harvester
Plots list, so they are not farming. ¿what is causing that? ¿Is any other way to know what is the problem with those plots, or is
there a way of repair them? A cannot nd any informations of this regard. Thaks a lot!!

Rafa

Loading...

Pingback: Optimizing Plotters in Windows – The Chia Farmer

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 10/11
18.05.2021 Печать с помощью PowerShell в Windows - Фермер Чиа

gokyuzugokturk
May 10, 2021 at 6:52 pm

Hi Alex, thank you for this great guide. Is there any way to see the total progress % in PowerShell like in the Chia CLI ?

Loading...

Alex Armstrong
May 10, 2021 at 7:06 pm

К сожалению, общий прогресс в PowerShell сделать немного сложнее. Я уверен, что способ есть, но я не рассматривал
его, чтобы увидеть.

Загружается ...

Генри
11 мая 2021 года в 5:31

Просто интересно, если я запустил сценарий Powershell для построения графика, могу ли я открыть графический
интерфейс для сбора урожая? Будут ли новые графики, созданные с помощью PowerShell, автоматически отображаться в
разделе Фермы в графическом интерфейсе, или мне нужно вручную добавлять эти графики через графический
интерфейс?

Загружается ...

Алекс Армстронг
11 мая 2021 года в 9:39

Да, вы все еще можете открыть графический интерфейс. И графики будут автоматически отображаться у фермера, если
последний каталог останется таким же.

Загружается ...

Комментарии закрыты.

Чиа фермер

https://thechiafarmer.com/2021/04/19/plotting-with-powershell-on-windows/ 11/11

Вам также может понравиться