From 2f4a442596888da8a4a406a09c47088afce8d621 Mon Sep 17 00:00:00 2001 From: Troy Kessler <43882936+troykessler@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:36:23 +0100 Subject: [PATCH] Integrate KYVE into sync from genesis section (#428) chore: added kyve block-sync docs --- .../5.join-a-network/2.sync-from-genesis.md | 143 +++++++++++++++++- 1 file changed, 142 insertions(+), 1 deletion(-) diff --git a/content/4.validators/1.running-a-node/5.join-a-network/2.sync-from-genesis.md b/content/4.validators/1.running-a-node/5.join-a-network/2.sync-from-genesis.md index e5214767..5a42a140 100644 --- a/content/4.validators/1.running-a-node/5.join-a-network/2.sync-from-genesis.md +++ b/content/4.validators/1.running-a-node/5.join-a-network/2.sync-from-genesis.md @@ -8,6 +8,10 @@ description: Start your node by syncing it from the genesis block. # Sync from genesis This is the slowest (and most secure) way to sync your node, as your node goes through every block since the genesis block. +There are two ways for syncing your node from genesis: + +1. Through an archival node RPC. +2. Through the validated and archived blocks by KYVE. ::alert{variant="info"} @@ -79,7 +83,7 @@ wget https://github.com/archway-network/networks/blob/main/constantine-3/genesis -## Start the node +## 1. How to sync through RPC ### Start archwayd (default) @@ -365,7 +369,144 @@ sudo systemctl status archwayd :: +## 2. How to sync through KYVE + +KYVE is a blockchain that validates and archives chain data like Archway blocks and state-sync snapshots. +The tool KSYNC provides the possibility to use the validated data in order to sync an Archway node +to any height. + +::alert{variant="info"} +More information about KSYNC can be found in the [KYVE Docs](https://docs.kyve.network/ksync). +#title +Info +:: + +### KSYNC Installation + +#### Install with Go (recommended) + +Install the latest version: + +```bash +go install github.com/KYVENetwork/ksync/cmd/ksync@latest +``` + +Run `ksync version` to verify the installation. + +#### Install from source + +You can also install from source by pulling the ksync repository and switching to the correct version and building +as follows: + +```bash +git clone git@github.com:KYVENetwork/ksync.git +cd ksync +git checkout tags/vx.x.x -b vx.x.x +make ksync +``` + +This will build ksync in `/build` directory. Afterwards, you may want to put it into your machine's PATH like +as follows: + +```bash +cp build/ksync ~/go/bin/ksync +``` + +### Starting KSYNC (default) + +You can _block-sync_ from genesis up to live height with the blocks +validated and archived by KYVE with the following command: + +```bash +ksync block-sync --binary="/path/to/archwayd" --source="archway" +``` + +You can also continue the _block-sync_ from your current height to any +target height you specify with `--target-height`. + +```bash +ksync block-sync --binary="/path/to/archwayd" --source="archway" --target-height= +``` + +### Starting KSYNC as a service + +Since syncing from genesis can take a while a service file can be used to +allow the automatic restart of the service. + +You can create a service file with: + +::highlight-card + +```bash +nano /etc/systemd/system/archwayd.service + +``` + +:: + +And add the following content to the file: + +::highlight-card + +```service +[Unit] +Description=KSYNC Archway Node +After=network-online.target +[Service] +User=$USER +ExecStart=/home/$USER/go/bin/ksync block-sync --binary="/path/to/archwayd" --source="archway" +Restart=always +RestartSec=3 +LimitNOFILE=4096 +[Install] +WantedBy=multi-user.target + +``` + +:: + +You can then reload the systemctl daemon: +::highlight-card + +```bash + +sudo systemctl daemon-reload +``` + +:: + +Enable the service: + +::highlight-card + +```bash +sudo -S systemctl enable archwayd +``` + +:: + +And then start **archwayd** as a service: + +::highlight-card + +```bash + +sudo systemctl start archwayd +``` + +:: + + +You can then check that the service is properly running with: +::highlight-card + +```bash + +sudo systemctl status archwayd +``` + +:: ## Cleaning up (optional)