Block, Height & State-Sync Source with KSYNC

The following doc covers a step by step guide on how to sync sourced nodes with validated block data stored with KYVE and how to apply the validated state-sync snapshots at any historical height with KSYNC. This allows Source node operators to sync from genesis to live height without the need of relying on peers and furthermore allows sourced node operators and developers to sync to any historical height within minutes.

For further information about the KYVE Protocol architecture, please take a look at the documentation.

Install KSYNC

Install the latest KSYNC version v1.4.5 with

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

Verify the installation with

ksync version

More information about KSYNC can be found here: https://docs.kyve.network/ksync

Install sourced

If sourced is not installed yet install sourced with

git clone 
https://github.com/Source-Protocol-Cosmos/source.git

cd source
git checkout v3.0.1
make build

./sourced version

Init source with

./sourced init <moniker> –chain-id source-1

curl -s  https://raw.githubusercontent.com/Source-Protocol-Cosmos/mainnet/master/source-1/genesis.json > ~/.source/config/genesis.json

Example 1: Block-Sync from genesis:

Now that everything is installed you can block-sync with KSYNC with the following command:

ksync block-sync --binary="/path/to/sourced" --chain-id=kaon-1 --source=source

KSYNC will now rapidly sync all blocks until it hits the last block stored by the data pool.

State-Sync to height 6,000

In order to state-sync to live height simply execute the following command (96,000 is in the time of writing the newest snapshot, if the pool runs for a few more weeks it would be at live height)

ksync state-sync --binary="/path/to/sourced" --chain-id=kaon-1 --source=source --target-height=6000 -r

After the state-sync is completed you can start syncing blocks from the network normally

./sourced start --p2p.seeds=7347b05f140e4ed5d3da7b26c754a486dc1d2ecd@source-mainnet-seed.itrocket.net:32656

Height-Sync to height 9,496

In order to rapidly sync to any historical height within minutes KSYNC uses both state and block-sync to reach the target height as quickly as possible:

ksync height-sync --binary="/path/to/sourced" --chain-id=kaon-1 --source=source --target-height=9496 -r

After the target height was reached you can inspect the state at this height in order for example to checkout account balances at this specific height.

Last updated