User Tools

Site Tools


guides:farming:chia_autostart_windows

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:

C:\Yourlocation\BootChia.bat
timeout /t 60 >NUL
START "Daemon" /b /normal %LOCALAPPDATA%\Programs\Chia\resources\app.asar.unpacked\daemon\chia.exe start farmer
Exit

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:

  1. 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).
  2. A START function: Starts the Chia Daemon and the farmer
  3. 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

  1. Click the Windows Start button and type in “Task Scheduler”
  2. Press “Create Task” (in Actions pane). A window appears
  3. Name: BootChia
  4. Description: Whatever
  5. Toggle “Run whether user is logged on or not”
  6. Tab Triggers
  7. Press “New”
  8. Select as Begin the task: At Startup
  9. Tab “Actions”
  10. Action → Start a program“
  11. Program/script → <Yourlocation>\BootChia.bat
  12. Add arguments (optional) → ”>\ChiaBoot.log 2>&1“ (Note both larger than signs, they are required)
  13. Start in (optional) → <Yourlocation>
  14. 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.

  1. 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.
  2. Change Directory to the folder in 1, in our case the Downloads folder: cd C:\Users\<username>\Downloads\nssm-2.24\win64
  3. type nssm.exe and hit enter
  4. Install chia.exe as a service: type nssm install Chia-service and hit enter
  5. A window will pop up. In the “Application” tab in the “Path” field fill in the location of the chia.exe file: %LOCALAPPDATA%\Programs\Chia\resources\app.asar.unpacked\daemon\chia.exe
  6. Under “Startup directory”, us the the same, but without \chia %LOCALAPPDATA%\Programs\Chia\resources\app.asar.unpacked\daemon\
  7. Under “Arguments” put start farmer
  8. 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.
  9. in the “Details” tab, select “automatic” in the dropdown.
  10. 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).

Now when your system reboots, chia.exe will automatically start. For more information, visit https://nssm.cc/usage and https://www.youtube.com/watch?v=96OtET8HmA0

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

guides/farming/chia_autostart_windows.txt · Last modified: 2024/01/05 08:07 by aj

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki