Skip to main content

State-Sync to latest Lava snapshot with KSYNC (recommended)

You can state-sync to the latest available Lava state-sync snapshot archived by the KYVE Network with the CLI tool KSYNC. To start you have to install the latest Lava binary version, you can find the latest ones here: https://github.com/lavanet/lava/releases. You can install the latest Lava binary already in the correct Cosmosvisor upgrade directory and update the symlink current to the latest version. Verify it by running: ./cosmovisor run version.

Next install KSYNC, if go1.22 is installed you can directly install it with:

go install github.com/KYVENetwork/ksync/cmd/ksync@latest

You can also build it from source:

git clone [email protected]:KYVENetwork/ksync.git
cd ksync
git checkout tags/vx.x.x -b vx.x.x
make build
cp build/ksync ~/go/bin/ksync

After KSYNC has been successfully installed and verified with ksync version you can state-sync to the latest available state-sync snapshot with the following command:

ksync state-sync --binary /path/to/lavad --chain-id kaon-1 -r

If you have installed the latest lava binary in cosmovisor you can also point the binary to cosmovisor:

ksync state-sync --binary /path/to/cosmovisor --chain-id kaon-1 -r

This will take around one minute, after that you can continue to p2p sync from the snapshot height. You can find the archived state-sync snapshots here detailed documentation regarding KSYNC here.

Finally, configure the Cosmovisor service to run on boot, and start it

# Enable the cosmovisor service so that it will start automatically when the system boots
sudo systemctl daemon-reload
sudo systemctl enable cosmovisor.service
sudo systemctl restart systemd-journald
sudo systemctl start cosmovisor

Block-Sync from genesis up to live height for full and archival node (optional)

You can skip this section if you have state-synced to live height already.

If you want to perform a full sync from genesis up to live height in order to operate a full or even an archival Lava node you can block-sync all blocks which have been permanently archived by KYVE with KSYNC, very similar to the state-sync section above. To continue, make sure that KSYNC is installed, the installation steps are explained above and in the official KSYNC documentation.

Next install all Lava upgrades in cosmovisor, the full version history can be found here. If KSYNC should perform all the upgrades automatically you need to have a systemd process configured which automatically restarts KSYNC after an upgrade was executed, below you can find a template:

[Unit]
Description=KSYNC deamon supervising the ksync sync process
After=network-online.target

[Service]
User=<user>
WorkingDirectory=$HOME
ExecStart=$HOME/ksync block-sync --binary="/path/to/cosmovisor" --chain-id="kaon-1" -y
Restart=always
RestartSec=10s
LimitNOFILE=infinity
Environment="DAEMON_NAME=<binary>"
Environment="DAEMON_HOME=$HOME/.<binary>"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=false"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"

[Install]
WantedBy=multi-user.target

Please replace the user and the path to your cosmovisor with your actual values. You can now reload the systemctl daemon:

sudo -S systemctl daemon-reload

and enable KSYNC as a service:

sudo -S systemctl enable ksync

You can now start KSYNC by executing:

sudo systemctl start ksync

Make sure to check that the service is running by executing:

sudo journalctl -u ksync -f

You can find another detailed example on how to sync from genesis with KSYNC here.