Running a Full Node
This document outlines the process for running a full ZetaChain node. It is intended for those who are familiar with the Linux operating system and the command line interface.
Please refer to Technical Requirements for more details on the technical requirements for running a ZetaChain node.
Getting Started
Set Limits on Open Files and Number of Processes
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
Create zetachain User Account
We recommend running ZetaChain binary files with a user account rather than as root.
useradd -m -s /bin/bash zetachain
Create ZetaChain Directory Structure
This is needed to store ZetaChain binary and configuration files.
sudo su zetachain
mkdir -p /home/zetachain/.zetacored/bin
mkdir /home/zetachain/.zetacored/config
Download and Install the zetacored binary
Binaries are built based on OS version and CPU architecture. You can download the latest binaries from our ZetaChain Node GitHub Repo
Install it in your PATH:
/usr/local/bin/zetacored
General Settings
Install ZetaChain Configuration Files
ZetaChain configuration files can be downloaded from the Athens3 Github Repo
Install it as follows:
/home/zetachain/.zetacored/config/app.toml
/home/zetachain/.zetacored/config/client.toml
/home/zetachain/.zetacored/config/config.toml
/home/zetachain/.zetacored/config/genesis.json
Create a Systemd Unit File
We recommend using Systemd to start and stop ZetaChain binary files and view the
logs. You can create a Systemd unit file at the following location
/etc/systemd/system/zetacored.service
:
[Unit]
Description=Zetacored Service
After=multi-user.target
StartLimitIntervalSec=0
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
Restart=always
RestartSec=90
User=zetachain
LimitNOFILE=262144
ExecStart=zetacored start --home /home/zetachain/.zetacored/ --log_format json --log_level info --moniker <YOUR_NODE_NAME_HERE>
Then start the service with systemctl start zetacored
.
You can view the logs with journalctl -o cat -f -u zetacored
.
CLI
ZetaChain Core is built with the Cosmos SDK. There is an —help
flag that can
be used with any subcommand to learn its use and syntax.
zetacored --help
Monitoring
In a production environment we recommend monitoring the node resources (CPU load, Memory Usage, Disk usage and Disk IO) for any performance degradation.
ZetaChain Core generates a log that can be monitored for errors and used for
troubleshooting. If you install Zetacore as a Systemd service using the
instructions above you can view this log with
journalctl -o cat -f -u zetacored
.
Prometheus can be enabled to serve metrics which can be consumed by Prometheus collector(s). Telemetry include Prometheus metrics can be enabled in the app.toml file. See the CosmosSDK Telemetry Documentation for more information.
Syncing from a StateSync node
Testnet
Region | IP |
---|---|
N. Virginia (US East) | 52.3.196.71 |
Singapore (APAC South East) | 3.0.80.230 |
Mainnet
Region | IP |
---|---|
N. Virginia (US East) | TBD |
Oregon (US West) | TBD |
Ireland (EU West) | TBD |
Singapore (APAC South East) | TBD |
Use the state sync node closer your node. Run the following command to collect
the latest block height
and latest block hash
:
curl -s http://<closest StateSync IP>:26657/block | jq -r '.result.block.header.height + "\n" + .result.block_id.hash'
Example Output
$ curl -s http://52.3.196.71:26657/block | jq -r '.result.block.header.height + "\n" + .result.block_id.hash'
120659
2554175FC58E5AC01723903971D1153BC1AF5341A51E5EABC22904730085B3CA
Use the return values to edit the following variables in
/home/zetachain/.zetacored/config/config.toml
[statesync]
# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine
# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in
# the network to take and serve state machine snapshots. State sync is not attempted if the node
# has any local state (LastBlockHeight > 0). The node will have a truncated block history,
# starting from the height of the snapshot.
enable = true
# RPC servers (comma-separated) for light client verification of the synced state machine and
# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding
# header hash obtained from a trusted source, and a period during which validators can be trusted.
#
# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2
# weeks) during which they can be financially punished (slashed) for misbehavior.
rpc_servers = "<closest StateSync IP>:26657,<closest StateSync IP>:26657"
trust_height = <return value for the latest block height>
trust_hash = "<return value for the latest block hash>"
Start the ZetaChain node:
zetacored start