Table of Contents
Chia Autostart (Windows)
In this guide, we show you two methods for automatically restarting you Chia processes upon system reboot.
- Method 1: Using a batchfile and the built-in Task Scheduler (recommended)
- Method 2: Using nssm.cc (this uses 3rd party software, use at own risk)
Method 1: Batchfile
This is a way to run the Chia node/farmer/harvester on a headless Windows machine by using Windows Task Scheduler. Anytime the machine reboots, this will start the Chia farmer automatically. Windows Task Scheduler will facilitate Chia farmer to run in a user context without having to log on to the system.
What you need is a batchfile in some location (eg
C:\<Yourlocation>\BootChia.bat). You will also need to create a task through Task Scheduler.
Step 1 - Creating the Batchfile
Open Notepad and copy the following lines:
timeout /t 60 >NUL
START “Daemon” /b /normal %LOCALAPPDATA%\Programs\Chia\Chia.exe start farmer
and save in any location (eg
C:\<Yourlocation>) as “
BootChia.bat”. You might need to check / manually replace the pasted double quote characters in the bat file as the wiki converts them to an incompatible type it seems.
The script has 3 components:
- A timeout: The timeout is to allow any initialization of virtual drives. If the log file (see below) shows errors then you may want to increase this to, say, 120 (seconds).
- A START function: Starts the Chia Daemon and the farmer
- Exit: closes the Batchfile
Note: The chia.exe path was changed in a 1.6.x release to a more convenient structure where the version reference was removed from the full path. On older client versions you will need to fetch and change the version specific path to chia.exe in the .bat file. (More information)
You can cause plotting to start automatically as well, visit our discord server if you want to learn how.
Step 2 - Task Scheduler
- Click the Windows Start button and type in “Task Scheduler”
- Press “Create Task” (in Actions pane). A window appears
- Name: BootChia
- Description: Whatever
- Toggle “Run whether user is logged on or not”
- Tab Triggers
- Press “New”
- Select as Begin the task: At Startup
- Tab “Actions”
- Action → Start a program“
- Program/script →
- Add arguments (optional) → ”>\ChiaBoot.log 2>&1“ (Note both larger than signs, they are required)
- Start in (optional) →
- Press OK and again OK. You may need to provide your user password.
Voilà, next time your PC restarts, Chia will automatically start up. To ensure everything is working as intended you can open a Powershell window and run the following command to verify the farmer is processing incoming challenges correctly
Get-Content ~\.chia\mainnet\log\debug.log -wait -tail 50 | Select-String “eligible”
Method 2 - using nssm.cc
nssm.cc (Non-Sucking Service Manager) allows you to start Chia as a service. Note that this requires to download (unmaintained) third-party software, so use at your own risk.
- Download at https://nssm.cc/download and unzip. You can save this in any location on your PC, but in this example we use the Downloads folder. You may replace that part of the path to your location if you safe it somewhere else.
- Change Directory to the folder in 1, in our case the Downloads folder:
nssm.exeand hit enter
- Install chia.exe as a service: type
nssm install Chia-serviceand hit enter
- A window will pop up. In the “Application” tab in the “Path” field fill in the location of the chia.exe file:
- Under “Startup directory”, us the the same, but without \chia
- Under “Arguments” put
- proceed to the “Logon” tab. Select “this account” and provide your username and password Again a disclaimer: Third-party software, use at your own risk.
- in the “Details” tab, select “automatic” in the dropdown.
- Click “Install Service” and you are done.
Go to the Windows Start button look for the “Services” app. Here you will find “Chia-service”. You can rightclick and press “Start” to test if it works (make sure you have no other instances of Chia running).
Disable Windows Auto-update
If you want to disable Windows automatic update, you can follow this guide: https://www.windowscentral.com/how-stop-updates-installing-automatically-windows-10.
Note that stalling updates for too long is not recommended (there's a reason for the updates).