/kysor

🚀 The Cosmovisor of KYVE

Primary LanguageTypeScriptApache License 2.0Apache-2.0

KYVE + COSMOVISOR

banner

Why use KYSOR

KYVE has a broad ecosystem of projects archiving their data with KYVE. To standardize different data from different projects KYVE created special runtimes for standards like @kyve/evm for all EVM based chains. This has great benefits but also has downsides for protocol node runners in terms of user experience.

Without KYSOR for every pool the node runner has to get the binaries manually. If you want to run on another pool which has a different runtime you again have to manually obtain the binaries. Furthermore, if a pool ever upgrades to a newer protocol node version, you have the same procedure like before. Even worse, you might miss the update and receive a timeout slash for being offline

Running nodes with KYSOR has the following benefits:

  • Only use one program to run on every pool
  • Not installing and compiling protocol binaries manually for every pool
  • Getting the new upgrade binaries during a pool upgrade automatically and therefore don't risk timeout slashes
  • Make running protocol nodes standardized and easier

Installation

Currently, there are no binaries for the KYSOR, therefore it has to be installed and build manually by cloning the repository:

git clone https://github.com/kyve-org/kysor.git
cd kysor

Install dependencies

In order to get started run the following in the project root directory:

yarn install

Setup

General directory structure and important files:

  • src contains all the source code of KYSOR
  • kysor.conf.ts is the main config file. It is explained in more detail below
  • secrets is the directory where your secrets are stored like arweave.json and mnemonic.txt
  • runtimes will be autogenerated once you start KYSOR and will contain all binaries structured by runtime and version
  • db will be autogenerated once you start KYSOR and will contain all caching data for the protocol nodes
  • logs will be autogenerated once you start KYSOR and will contain all log data for the protocol nodes

In order to setup KYSOR the following secrets need to be added under the secrets directory:

  • arweave.json this is the arweave keyfile you need to provide in order to run protocol nodes. This one keyfile will be used for all of your protocol nodes
  • mnemonic.txt this is the file which contains your mnemonic of your validator account. This one mnemonic will be used for all of your protocol nodes

After adding the required secrets you can check the kysor.conf.ts file. When you initially open it, it should look like this:

import { IConfig } from "./src/faces";

const config: IConfig = {
  // target of the host machine, can be either "linux" or "macos"
  // important for downloading the correct binaries
  hostTarget: "linux",

  // whether KYSOR should auto download new binaries
  // if set to false, you have to insert the binaries manually
  autoDownload: true,

  // whether KYSOR should verify the checksums of downloaded binaries
  // if autoDownload is false this option can be ignored
  verifyChecksums: true,

  // settings for protocol node
  // notice that mnemonic and keyfile is missing, those need to be files under the secrets directory
  protocolNode: {
    // the ID of the pool you want to join as a validator
    // an overview of all pools can be found here -> https://app.kyve.network
    poolId: 0,

    // the network you want to run on
    // currently only the testnet network "korellia" is available
    network: "korellia",

    // the amount of $KYVE you want to stake
    // will only get applied if you are not a validator yet
    // once you are a validator you can manage your stake in the KYVE app
    initialStake: 100,

    // the amount of bytes the node can use at max to cache data
    // 1000000000 equals 1 GB which is usually enough
    space: 1000000000,

    // specify verbose logging
    // is often recommended in order to have a more detailed insight
    verbose: true,
  },
};

export default config;

Since this file is commented and explained in detail the info regarding config properties can be found in this file. Every time you edit the config file you have to build the project with yarn build.

After entering your config like the poolId and your initialStake and other settings that are required to run a protocol node on a pool you can start KYSOR by running

yarn build
yarn start

When you see logs like this everything should work fine

2022-05-19 13:54:00.299  INFO  Starting KYSOR ...
2022-05-19 13:54:00.299  INFO  Validating files ...
2022-05-19 13:54:00.300  INFO  Found kysor.conf.ts
2022-05-19 13:54:00.300  INFO  Found arweave.json
2022-05-19 13:54:00.300  INFO  Found mnemonic.txt
2022-05-19 13:54:00.300  INFO  Creating "runtimes" directory ...
2022-05-19 13:54:00.300  INFO  Attempting to fetch pool state.
2022-05-19 13:54:00.543  INFO  Fetched pool state
2022-05-19 13:54:00.543  INFO  Binary of runtime "@kyve/evm" with version 1.0.5 not found locally
2022-05-19 13:54:00.544  INFO  Found downloadable binary on pool
2022-05-19 13:54:00.545  INFO  Downloading https://github.com/kyve-org/evm/releases/download/v1.0.5/kyve-linux.zip?checksum=8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c ...
2022-05-19 13:54:01.910  INFO  Extracting binary to "./runtimes/@kyve/evm/1.0.5/kyve.zip" ...
2022-05-19 13:54:02.315  INFO  Deleting kyve.zip ...
2022-05-19 13:54:02.664  INFO  Comparing binary checksums ...

2022-05-19 13:54:02.666  INFO  Found checksum = 8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c
2022-05-19 13:54:02.666  INFO  Local checksum = 8662ddeb3a3e0eaedbbb5a665a4fa0eed12448349218ef0d98afed25cfacd60c

2022-05-19 13:54:02.666  INFO  Checksums are equal. Continuing ...
2022-05-19 13:54:02.666  INFO  Starting child process ...


2022-05-19 13:54:06.858  INFO  Starting node ...

2022-05-19 13:54:06.861  INFO  Name              = impressed-emerald-spoonbill
2022-05-19 13:54:06.953  INFO  Address           = kyve1eka2hngntu5r2yeuyz5pd45a0fadarp3zue8gd
2022-05-19 13:54:06.954  INFO  Pool Id           = 0
2022-05-19 13:54:06.954  INFO  @kyve/core        = v1.0.8
2022-05-19 13:54:06.954  INFO  @kyve/evm         = v1.0.5

2022-05-19 13:54:06.955  DEBUG Attempting to fetch pool state.
2022-05-19 13:54:07.245  INFO  Running node on runtime @kyve/evm.
2022-05-19 13:54:07.248  INFO  Pool version requirements met
2022-05-19 13:54:07.249  INFO  Fetched pool state
2022-05-19 13:54:07.349  INFO  Node is already staked. Skipping ...
2022-05-19 13:54:07.350  INFO  Running node with a stake of 100.0000 $KYVE