Run a Node
Start Here
Setting Up a Node

First, download the binary and give it executable permissions. Make sure to replace the VERSION with the latest version passed in a governance software upgrade proposal and the platform (-linux-amd64) with the one you need.

sudo wget https://github.com/zeta-chain/node/releases/download/VERSION/zetacored-linux-amd64 -O /usr/local/bin/zetacored &&\
sudo chmod a+x /usr/local/bin/zetacored

Check out the GitHub for more information on releases (opens in a new tab).

Check that you have the correct version of zetacored installed:

zetacored version

We recommend running ZetaChain binary files with a user account rather than as root.

sudo useradd -m -s /bin/bash zetachain
NetworkChain ID
Mainnetzetachain_7000-1
Testnetathens_7001-1
sudo -u zetachain zetacored init MONIKER --chain-id zetachain_7000-1

Replace MONIKER with a name for your node. By default the node will be initialized in $HOME/.zetacored, but you can customize this with the --home flag.

Fetch and save config files in the data directory:

sudo -u zetachain wget https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json -O /home/zetachain/.zetacored/config/genesis.json &&\
sudo -u zetachain wget https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml -O /home/zetachain/.zetacored/config/client.toml &&\
sudo -u zetachain wget https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml -O /home/zetachain/.zetacored/config/config.toml &&\
sudo -u zetachain wget https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml -O /home/zetachain/.zetacored/config/app.toml

Even though the config files you fetched in the previous step already contain all the required values common for all nodes, you will need to make some adjustments specific to your node.

If your machine has an external IPv4 address you can get it by running the command in your terminal:

curl -4 icanhazip.com

If you have an IPv6 address, you can use that as an external address.

Replace the moniker and external address with correct values.

~/.zetacored/config/config.toml
moniker = "{MONIKER}"
external_address = "{YOUR_EXTERNAL_IP_ADDRESS_HERE}:26656"

To better manage the resources of your nodes, we recommend setting some limits on the maximum number of open file descriptors (nofile) and maximum number of processes (nproc).

Edit /etc/security/limits.conf to include or modify the following parameters:

*       soft    nproc   262144
*       hard    nproc   262144
*       soft    nofile  262144
*       hard    nofile  262144

Edit /etc/sysctl.conf to include the following:

fs.file-max=262144

From the cosmos docs (opens in a new tab):

cosmovisor is a process manager for Cosmos SDK application binaries that automates application binary switch at chain upgrades. It polls the upgrade-info.json file that is created by the x/upgrade module at upgrade height, and then can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.

From Source

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.7.1
mv $(go env GOPATH)/bin/cosmovisor /usr/local/bin/cosmovisor

From Precompiled Binaries

Download the correct binary from the cosmovisor v1.7.1 release (opens in a new tab). For example:

wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.7.1/cosmovisor-v1.7.1-linux-amd64.tar.gz
tar xf cosmovisor-v1.7.1-linux-amd64.tar.gz &&\
chmod a+x cosmovisor &&\
sudo mv cosmovisor /usr/local/bin

Create cosmovisor Directories

sudo -u zetachain mkdir -p /home/zetachain/.zetacored/cosmovisor/genesis/bin &&\
sudo -u zetachain mkdir -p /home/zetachain/.zetacored/cosmovisor/upgrades

Install the Current zetacored Binary

Find the current zetacored binary as specified in setup. Place it in /home/zetachain/.zetacored/cosmovisor/genesis/bin rather than $PATH.

sudo -u zetachain cp /usr/local/bin/zetacored /home/zetachain/.zetacored/cosmovisor/genesis/bin

Configure a Systemd Unit File

Create the systemd.unit path for locally install systemd units:

sudo mkdir -p /usr/local/lib/systemd/system/

Create the file /usr/local/lib/systemd/system/zetacored.service:

cat <<EOF | sudo tee /usr/local/lib/systemd/system/zetacored.service
[Unit]
Description=zetacored (running under cosmovisor)
After=multi-user.target
StartLimitIntervalSec=0
[Install]
WantedBy=multi-user.target
[Service]
WorkingDirectory=/home/zetachain/.zetacored/cosmovisor
Environment="DAEMON_HOME=/home/zetachain/.zetacored"
Environment="DAEMON_NAME=zetacored"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_DATA_BACKUP_DIR=/home/zetachain/.zetacored"
Environment="CLIENT_DAEMON_NAME=zetaclientd"
Environment="CLIENT_SKIP_UPGRADE=false"
Environment="CLIENT_START_PROCESS=false"
Environment="UNSAFE_SKIP_BACKUP=true"
Type=simple
Restart=always
RestartSec=10
User=zetachain
LimitNOFILE=262144
ExecStart=cosmovisor run start --home /home/zetachain/.zetacored/ --log_format json
EOF

In this example, we have set DAEMON_ALLOW_DOWNLOAD_BINARIES=true. This instructs cosmovisor to automatically download the new binaries specified in the upgrade proposal. This would fail if the GitHub API is down. We suggest keeping this feature enabled, but preloading and validating any new binaries before the upgrade to minimize risk. If you have already preloaded the binaries, none will be downloaded. Read more about cosmovisor Auto-Download here (opens in a new tab).

Run sudo systemctl daemon-reload to load the service.

Run sudo systemctl enable zetacored to automatically start the service at boot. You should see the following message:

Created symlink /etc/systemd/system/multi-user.target.wants/zetacored.service → /usr/local/lib/systemd/system/zetacored.service.

Upgrade Readiness

Follow the #testnet-announcements (opens in a new tab) and/or #mainnet-announcements (opens in a new tab) channels on discord to receive upgrade proposal notifications.

To prepare for upgrades, download the new binaries from the github release and install them into the cosmovisor upgrade directory. The name of the directory must match the upgrade name. The upgrade name is not the the release name on github. Reference the Governance Upgrade Proposals page to easily see the upgrade names. Here are some examples:

Upgrade Namezetacored Pathgit tag
v26~/.zetacored/cosmovisor/upgrades/v26/bin/zetacoredv26.0.0
v27~/.zetacored/cosmovisor/upgrades/v27/bin/zetacoredv27.0.1

After installing the binary, you should:

  • validate the checksum is correct
  • run zetacored version to validate that you can actually run the downloaded binary

Monitoring

In a production environment we recommend monitoring the node resources (CPU load, Memory Usage, Disk usage and Disk IO) for any performance degradation.

zetacored generates logs that can be monitored for errors and used for troubleshooting. If you installed zetacored as a Systemd service using the instructions above you can view logs with journalctl -eu zetacored.

Metrics

Prometheus is enabled by default to serve metrics on port 26660 which can be consumed by Prometheus collector(s). See the Cosmos SDK Telemetry Documentation (opens in a new tab) for more information.