Skip to content

Network Operations

Kosta Korenkov edited this page Nov 9, 2019 · 6 revisions

Checklist for a new network

TODO: validator, sentinel, failover nodes (0downtime), load balancers with HTTPS/WSS, generate genesis, create network config, create peer list in the config

Setting up the (virtual) machine to run the leap-node

# Update instance
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove

# Create 1Gb swap
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
echo '/var/swap.1 swap swap defaults 0 0' | sudo tee --append /etc/fstab

# install node.js and yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo 'deb https://dl.yarnpkg.com/debian/ stable main' | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get -y install build-essential
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get -y install yarn

TODO: leap-node, logging, systemd service, firewall/security groups

Setting up AWS Load Balancer for JSON RPC nodes

TODO

How to setup the network for 0-downtime upgrades

https://github.com/leapdao/leap-node/issues/185#issuecomment-468921734

TODO: add image with network topology (load balancer for sentinels, two validators in intranet etc)

How to migrate validator to the new network

Without tendermint upgrade

Drop node data (⚠️!) and copy validator keys to the new network folder (in this example from eta to theta, replace with your targets):

DEBUG=tendermint,leap-node* leap-node --config leap-testnet.json --fresh
cp ~/.lotion/networks/leap-testnet-eta-955601066/.priv ~/.lotion/networks/leap-testnet-theta-218508104/
mkdir ~/.lotion/networks/leap-testnet-theta-218508104/config
cp ~/.lotion/networks/leap-testnet-eta-955601066/config/priv_validator_key.json ~/.lotion/networks/leap-testnet-theta-218508104/config/
cp ~/.lotion/networks/leap-testnet-eta-955601066/config/node_key.json ~/.lotion/networks/leap-testnet-theta-218508104/config/
DEBUG=tendermint,leap-node* leap-node --config leap-testnet.json --fresh

With tendermint upgrade

if you start a validator for a new network keeping the old validator key, be sure to remove old validator state. In older tendermint version the state is kept in priv_validator.json file along with the key you want to preserve.

  1. For older tendermint — edit priv_validator_key.json
  2. For new tendermint — just run the node with --fresh key (it will reset the state which is in a separate file from now on)

if you start a new network and upgrade to newer tendermint at the same time, then either a) use the 1 option before you run the upgrade leap-node for the first time. b) run updated node so that priv_validator structure is updated, stop the node, run it with --fresh, then start normally

How to check the validator is submitting periods

TODO

How to add new validator (PoA)

TODO: checklist for new validator, generate validator key with some ETH, call setSlot via governance