Skip to main content

Restarting the Validator

By default, when you set up a full node, the Validator container will wait for the following conditions to be met:

  1. The Consensus client is up and synced.
  2. Wait for 1 Epoch at least (using the validator-blocker service of the docker-compose.yml script).

You can set the number of epochs to wait using the flag --wait-epoch <number> on the generate command, the default value is 1.

After that, the Validator container will launch.

Restarting a Validator

If for any reason your setup is restarted, the validator will not start automatically. You will need to run it manually, because otherwise, it will not wait for the above conditions to be met, therefore, the restart might cause some slashing issues.


You need to restart the validator manually; if you instead configure the docker compose service to restart automatically, this can incur severe penalties for your node.

If the docker daemon restarts (due to a machine reboot, for example), the docker compose services with a restart policy will restart, but the depends_on policy won’t retake effect. The depends_on policy only takes effect after a docker compose up (for the reboot case). This means the Validator can’t set a restart policy until we run down and up after a reboot for it to now incur in any slashing.

Solution (Only for Unix-based systems)

To solve this problem, we found two workarounds:

  • Create a systemd service
  • Create a crontab job

Both of those solutions will run after a reboot and will run the docker compose up validator command.

Systemd service

You can use the following steps to automatically run docker compose up validator when your machine restarts:

  1. Create a systemd service file with the following content:
Description=Validator Restart Service

ExecStart=/usr/local/bin/docker compose up -d validator


Replace /path/to/docker-compose/file with the actual path to your docker-compose.yml file. You may also need to adjust the ExecStart path if your docker binary is located elsewhere.

  1. Save the file as /etc/systemd/system/validator-restart.service.
  2. Reload the systemd daemon:
sudo systemctl daemon-reload

  1. Enable the service to start automatically at boot:
sudo systemctl enable validator-restart.service

  1. Start the service:
sudo systemctl start validator-restart.service

  1. After completing these steps, docker compose up validator will automatically run when your machine restarts. You can check the status of the service with:
sudo systemctl status validator-restart.service


If you need to stop the service, you can use the following command:

sudo systemctl stop validator-restart.service

Crontab job

To create a cron job that automatically runs docker compose up validator on system reboot, you should first create a shell script that runs the necessary commands, and then set up a cron job to execute the script at system startup.

Here's how to do it:

  1. Create a shell script: Open a terminal and navigate to the directory where your docker-compose.yml file is located. Then, create a new shell script file:
  1. Open the file with a text editor:
  1. Add the following content to the script:
# Change to the directory containing the docker-compose.yml file
cd /path/to/your/docker-compose/directory

# Load environment variables, if any
source .env

# Start the Docker Compose service
docker compose up -d validator

Replace /path/to/your/docker-compose/directory with the actual path of the directory containing your docker-compose.yml file. Save and exit the text editor.

  1. Make the script executable:
chmod +x
  1. Set up a cron job:

Run the following command to edit the system-wide crontab file:

sudo crontab -e

Add the following line at the end of the file:

@reboot /path/to/your/script/directory/

Replace /path/to/your/script/directory with the actual path of the directory containing your script. Save and exit the text editor.

Now, the cron job will automatically run docker compose up -d validator on system reboot.