# Kyve Chain Node- Korellia


By [GLCstaked](https://paragraph.com/@glcstaked) · 2023-01-25

---

**Setup a Chain node Validator for Kyve Network on Korellia Testnet.**

Hardware: 4vCPU, 4GB RAM (plus 8GB SWAP during chain-upgrades), 250GB SSD (will need room to expand) OS: Ubuntu 20.04LTS

**Kyve Network:** KYVE network is a decentralized archival framework that standardizes, validates, and permanently stores data streams using [Arweave’s](https://www.arweave.org/) permaweb.

**Chain Node:** handles the consensus of the Kyve chain the backbone of Kyve Network. The chain layer is a completely sovereign PoS Layer 1 with $KYVE for settlement. Chain node validators secure the chain by verifying new blocks to earn rewards. A Chain node can be set up as a consensus full node without registering a validator, see up to step 7.

**Protocol Node:** The Protocol Validator/Node collects data from a data source, bundling and uploading them to Arweave and verifying it, these data sources are pools that operators decide to validate on. To run a protocol node see

[https://mirror.xyz/0xf3bF9DDbA413825E5DdF92D15b09C2AbD8d190dd/Vab7jT5DR4-YrmhfKTjLmM28WIRfy8vNbAsyhRDTQJ4](https://mirror.xyz/0xf3bF9DDbA413825E5DdF92D15b09C2AbD8d190dd/Vab7jT5DR4-YrmhfKTjLmM28WIRfy8vNbAsyhRDTQJ4)

1\. Setup Dependencies
----------------------

update device

    sudo apt update && sudo apt upgrade -y
    

install software you will need to continue, you may already have these.

    sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq chrony liblz4-tool -y
    

Switch to root user

    sudo -i
    

**Install Go**

Download and unpack installation file to `/usr/local/`

    ver="1.19.4"
    wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
    rm -rf /usr/local/go
    tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
    rm "go$ver.linux-amd64.tar.gz"
    

Add to PATH

    echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
    source $HOME/.bash_profile
    

Confirm installation with `go version`

![](https://storage.googleapis.com/papyrus_images/611dc868249040abbf3f8d94556501d39a534828c56ed3d265c6ab2a6b0cc63c.png)

**Ports**

26657 | 6060 | 26656 | 9090 | 9091

2\. Download Kyve - Sync from Genesis
-------------------------------------

To sync from genesis, the Kyve binary must be **v.0.0.1** and upgraded manually at the upgraded block height for the required binary upgrades, you will be prompted in the logs of the chain node when this happens.

Syncing from Genesis may take some time (2-3weeks) there are methods for faster sync detailed later in this guide.

    cd $HOME
    mkdir -p $HOME/go/bin
    wget https://github.com/KYVENetwork/chain/releases/download/v0.0.1/chain_linux_amd64.tar.gz
    

Extract/ Make executable and move to `/$HOME/go/bin`

    tar -xvzf chain_linux_amd64.tar.gz
    chmod +x chaind && mv ./chaind $HOME/go/bin/
    rm chain_linux_amd64.tar.gz
    

**Initiate Chain**

Your `<moniker>` is the public name of your node/or validator

    chaind init <moniker> --chain-id korellia
    chaind config chain-id korellia      #rm
    

You should now have a working folder `.kyve`, this contains config files and chain data.

**Get genesis file**

It is important to start with the oldest version `v0.0.1` (the genesis version). and move to the working directory `.kyve/config`

    wget https://github.com/KYVENetwork/chain/releases/download/v0.0.1/genesis.json
    mv genesis.json ~/.kyve/config/genesis.json
    

Start the chain the first time:

    chaind start --p2p.seeds=02dd2c26948ea758a25d3dbc91744f8897681652@3.73.27.185:26656
    

**Working Peers**

some known peers that you can connect too, (at time of writing) will be updating every so often

    PEERS="06343ca0e5636591f38bb1940cccd9cb93bbd595@65.108.4.233:36656"
    

other peers:

![If this starts without an error, the output should look similar](https://storage.googleapis.com/papyrus_images/50762aacac7bc5bc0f8d1dceef31aec55e8616ca398975e617aba239380df17e.png)

If this starts without an error, the output should look similar

Stop the node `ctrl + c` recommend setting up as a system service to run in the background, or with Cosmovisor for auto upgrades.

Optional configurations
-----------------------

These are optional configurations which should help performance of the node, all of which can be edited manually in `config.toml` (maybe later after the chain reset?)

Seeds/Peers Settings

    sed -i -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $HOME/.kyve/config/config.toml
    seeds="e56574f922ff41c68b80700266dfc9e01ecae383@18.156.198.41:26656"
    peers=""
    sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.kyve/config/config.toml
    sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 100/g' $HOME/.kyve/config/config.toml
    sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 100/g' $HOME/.kyve/config/config.toml
    

pruning configurations

    pruning="custom" && \
    pruning_keep_recent="100" && \
    pruning_keep_every="0" && \
    pruning_interval="10" && \
    sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" ~/.kyve/config/app.toml && \
    sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" ~/.kyve/config/app.toml && \
    sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" ~/.kyve/config/app.toml && \
    sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" ~/.kyve/config/app.toml
    

Indexer disable

    indexer="null" && \
    sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.kyve/config/config.toml
    

**Adding an Address book**

when running the chain node when it discovers peers they will be added to the `addrbook.json` for quicker connections in future, adding an address book now will aid in much faster connections.

some members of Kyve community will host address books, here’s an example from

[https://github.com/obajay/nodes-Guides/tree/main/Kyve#build-281122](https://github.com/obajay/nodes-Guides/tree/main/Kyve#build-281122)

    wget -O $HOME/.kyve/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Kyve/addrbook.json"
    

3\. Create System Service
-------------------------

check which command shows /home/go bin

    tee <<EOF > /dev/null /etc/systemd/system/kyved.service
    [Unit]
    Description=KYVE Chain-Node daemon
    After=network-online.target
    
    [Service]
    User=$USER
    ExecStart=$(which chaind) start
    Restart=on-failure
    RestartSec=10
    LimitNOFILE=infinity
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

**Start Chain Node**

    systemctl daemon-reload && \
    systemctl enable kyved && \
    systemctl restart kyved && \
    journalctl -u kyved -f -o cat
    

`systemctl stop kyved` to stop the service

Faster Sync Options
-------------------

### 1\. State Sync

State Sync is connecting to a trusted node using this community members details, but the process will be similar with a change of peer for other examples.

[

My\_Testnets/KYVE/State Sync KYVE.md at main · 88Mikhail88/My\_Testnets
-----------------------------------------------------------------------

Contribute to 88Mikhail88/My\_Testnets development by creating an account on GitHub.

https://github.com

![](https://storage.googleapis.com/papyrus_images/1a3d14551fbe9093cfe3c821875c71f98dfc79c511781d65fc31056056804827.png)

](https://github.com/88Mikhail88/My_Testnets/blob/main/KYVE/State%20Sync%20KYVE.md)

**Stop node**

    sudo systemctl stop kyved
    

**Replace Kyve binary**

in this example the latest binary is `v0.7.0`

    cd $HOME/go/bin
    rm chaind
    
    wget https://kyve-korellia.s3.eu-central-1.amazonaws.com/v0.7.0/kyved_linux_amd64.tar.gz
    tar -xvzf kyved_linux_amd64.tar.gz
    chmod +x kyved
    sudo mv kyved $HOME/go/bin/chaind
    rm kyved_linux_amd64.tar.gz
    cd
    

**Reset Kyve chain data**

    chaind tendermint unsafe-reset-all
    

![](https://storage.googleapis.com/papyrus_images/88accdcc02e1d6e597cddb7fcbcf7ef15a3627296d2d0c8d8df9cf63d20c5f43.png)

**Set State sync configurations**

    SEEDS=""
    PEERS="06343ca0e5636591f38bb1940cccd9cb93bbd595@65.108.4.233:36656"
    sed -i.bak -e "s/^seeds =./seeds = "$SEEDS"/; s/^persistent_peers =./persistent_peers = "$PEERS"/" $HOME/.kyve/config/config.toml
    

    SNAP_RPC="http://65.108.4.233:36657"
    

    LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); BLOCK_HEIGHT=$((LATEST_HEIGHT)); TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
    

    sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).$|\1true| ; s|^(rpc_servers[[:space:]]+=[[:space:]]+).$|\1"$SNAP_RPC,$SNAP_RPC"| ; s|^(trust_height[[:space:]]+=[[:space:]]+).$|\1$BLOCK_HEIGHT| ; s|^(trust_hash[[:space:]]+=[[:space:]]+).$|\1"$TRUST_HASH"| ; s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1""|" $HOME/.kyve/config/config.toml
    

Change snapshot-interval = 1000

    nano .kyve/config/app.toml
    

Edit into the config like so

![](https://storage.googleapis.com/papyrus_images/4d7dbde5a5e3582560a3f12be867f9f98067261c1b32f14d5e4c5e576296ea7b.png)

**Restart node**

    systemctl daemon-reload
    systemctl restart kyved
    

check logs

    journalctl -u kyved -f -o cat
    

![Should look similar if it can find peers to sync ](https://storage.googleapis.com/papyrus_images/50e50ae100ed7dafd540d10a3b91d796b6320ff4dc40f16072d936c51323325d.png)

Should look similar if it can find peers to sync

Disable State Sync after node synchronization

    sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" $HOME/.kyve/config/config.toml
    

Pruning config

    recent=100
    every=0
    interval=10
    
    sed -i.back "s/pruning *=.*/pruning = \"custom\"/g" $HOME/.kyve/config/app.toml
    sed -i "s/pruning-keep-recent *=.*/pruning-keep-recent = \"$recent\"/g" $HOME/.kyve/config/app.toml
    sed -i "s/pruning-keep-every *=.*/pruning-keep-every = \"$every\"/g" $HOME/.kyve/config/app.toml
    sed -i "s/pruning-interval *=.*/pruning-interval = \"$interval\"/g" $HOME/.kyve/config/app.toml
    

### 2\. Snapshot

Snapshot is downloading the chain data instead of manually syncing from genesis, its obviously much faster but requires trust from the source of the data, Examples of Snapshot from the community….

Upgrading Binaries (manually)
-----------------------------

If not using cosmovisor, then Binaries must be updated manually at the required block height of the upgrade. Ensure that the block height is reached for the upgrade to take effect

1.  **Stop Node**
    
        systemctl stop kyved
        
    
2.  **Replace binary**
    
    for upgrading to `v0.7.0` replace as required
    
        cd $HOME/go/bin
        rm chaind
        
        wget https://kyve-korellia.s3.eu-central-1.amazonaws.com/v0.7.0/kyved_linux_amd64.tar.gz
        tar -xvzf kyved_linux_amd64.tar.gz
        chmod +x kyved
        sudo mv kyved $HOME/go/bin/chaind
        rm kyved_linux_amd64.tar.gz
        cd
        
    
3.  **Restart Node**
    
        systemctl daemon-reload
        systemctl restart kyved
        
    

Setup with Cosmosvisor
----------------------

Cosmovisor:

Add Wallet
----------

**Create new wallet**

    chaind keys add [your-key-name]
    

**Display validator address**

    chaind keys show [your-key-name] --bech val -a
    

**recover a wallet**

    chaind keys add [your-key-name] --recover
    

wallet config is stored in `.kyve` if the path is not specified

show wallet

    chaind keys list 
    

check balance

    chaind query bank balances "kyve1kh478sz3w0jznr9hrphd7sv6sfa5l9ju5f4jdg" --denom ukyve
    

Create Validator
----------------

    chaind tx staking create-validator --yes \
     --amount [amount]tkyve \
     --moniker [moniker] \
     --commission-rate "0.10" \
     --commission-max-rate "0.20" \
     --commission-max-change-rate "0.01" \
     --min-self-delegation "1" \
     --pubkey "$(./chaind tendermint show-validator)" \
     --from [your-key-name] \
     --chain-id korellia
    

Other commands
--------------

**check sync**

    curl localhost:26657/status
    

    curl -s localhost:26657/status | grep block_height
    curl -s localhost:26657/status | jq .result | jq .sync_info
    

**Delegate additional stake**

    ./chaind tx staking delegate [VALOPER_ADDRESS] [STAKE_AMOUNT]tkyve --from [your-key-name] --chain-id korellia 
    

**Unjail**

    ./chaind tx slashing unjail --chain-id korellia --from [your-key-name]
    

**Migrating Validator**

    cp $HOME/.kyve/data/priv_validator_state.json $HOME/.kyve/priv_validator_state.json.backup

---

*Originally published on [GLCstaked](https://paragraph.com/@glcstaked/kyve-chain-node-korellia-4)*
