AIOZ Node Snapshot

Chain ID: aioz_168-1 | Current Node Version: v1.5.0
LATESTBLOCK HEIGHTSIZETIMESTAMPDOWNLOAD
15515147236GB12 hours agoaioz_15515147.tar.lz4

IMPORTANT NOTE

  • This manual guide is written for Ubuntu 20.04.
  • Make sure you have at least 900GB free of storage.

ONE-CLICK INSTALL

Run below scripts to have everything setup automatically:

  sudo apt install curl -y
  curl -SL https://snapshot-data.aioz.network/one-click.sh | bash 

After executing above script, you will have a cosmovisor running AIOZ node as a background service named aioz.service. Cosmovisor is a process manager developed to relieve node operators of having to manually intervene every time there is an upgrade. Cosmovisor monitors the governance module for upgrade proposals: it will take care of downloading the new binary, stopping and backing up the old one, switching to the new one, and restarting node.

Below are some commands to monitor service:

  # to log running service
  sudo journalctl -u aioz.service -f 
  
  # stop service
  sudo systemctl stop aioz.service
  
  # restart service
  sudo systemctl restart aioz.service

In order to remove aioz.service completely:

  sudo systemctl stop aioz.service
  sudo rm /etc/systemd/system/aioz.service
  sudo systemctl daemon-reload

MANUAL INSTALL

Prepare binary and other utilies

Install software utilities:

  sudo apt update 
  sudo apt install snapd curl wget lz4 gzip -y

Make sure you have the correct binary version. You can download the latest version (now is v1.5.0) from here or simply run this script:

   sudo curl -SL https://archive.aioz.network/aiozd-v1.5.0-linux-amd64?checksum=sha256:637b4d8d6946e3dc660f3314338e52415cb8c060b45eff77e5b393033c04430b -o /usr/local/bin/aiozd
   sudo chmod +x /usr/local/bin/aiozd

Initialize the chain

Choose a custom moniker for the node and initialize. By default, the init command creates the $HOME/.aioz directory with subfolders config and data. In the /config directory, the most important files for configuration are app.toml and config.toml.

    aiozd init <moniker> --chain-id aioz_168-1

in which aioz_168-1 is the chain ID of AIOZ Network Mainnet.

The command above creates all the configuration files needed for your node to run, as well as a default genesis file, which defines the initial state of the network. All these configuration files are in $HOME/.aioz by default, but you can overwrite the location of this folder by passing the --home flag.

The moniker is a unique identifier for your node within the network. The moniker can be edited in the $HOME/.aioz/config/config.toml file. You can execute the below script to set default moniker for your node:

    sed -i 's/moniker = ".*"/moniker = "NODE"/g' $HOME/.aioz/config/config.toml

The $HOME/.aioz folder has the following structure:

│  data
│  config
└─── app.toml
└─── client.toml
└─── config.toml
└─── genesis.json
└─── node_key.json
└─── priv_validator_key.json

Genesis file

Once the node is initialized, download the genesis file and move to the config/ directory of the $HOME/.aioz home directory.

    wget https://raw.githubusercontent.com/AIOZNetwork/mainnet/main/genesis.aioz_168-1.json.gz
    gzip -d genesis.aioz_168-1.json.gz
    mv genesis.aioz_168-1.json $HOME/.aioz/config/genesis.json

Seeds & Peers

Upon startup the node will need to connect to peers. If there are specific nodes a node operator is interested in setting as seeds or as persistent peers, this can be configured in $HOME/.aioz/config/config.toml. Run this script to update default seeds for AIOZ Mainnet:

    sed -i 's/seeds = ".*"/seeds = "[email protected]:26656"/g' $HOME/.aioz/config/config.toml

Node operators can optionally download here the Quicksync address book. Make sure to move this to $HOME/.aioz/config/addrbook.json.

Gas & Fees

For mainnet, the recommended gas-prices is 7000000000attoaioz

A full-node keeps unconfirmed transactions in its mempool. In order to protect it from spam, it is better to set a minimum-gas-prices that the transaction must meet in order to be accepted in the node's mempool. This parameter can be set in $HOME/.aioz/config/app.toml. Run this script to set default minimum gas price on AIOZ Mainnet:

    sed -i 's/minimum-gas-prices = ".*"/minimum-gas-prices = "7000000000attoaioz"/g' $HOME/.aioz/config/app.toml

How to process AIOZ Snapshot

Download the latest snapshot:

    wget -O aioz_.tar.lz4 https://snapshot-data.aioz.network/aioz_.tar.lz4

Stop any running node. If you run a node as background service:

    sudo service aioz stop

Reset your node. This will erase your node database. If you are already running validator, be sure you backed up your priv_validator_key.json prior to running the the command. The command does not wipe the file. However, you should have a backup of it already in a safe location.

    cp $HOME/.aioz/data/priv_validator_key.json $HOME/.aioz/priv_validator_key.json

WARNING: If you use this snapshot on a validator node during a chain halt, make sure you back up priv_validator_state.json and then replace it after the snapshot is extracted but before you start the node process. This is very important in order to avoid double-sign. When in doubt, reach out to the project team.

    aiozd tendermint unsafe-reset-all --home $HOME/.aioz --keep-addr-book

Decompress the snapshot to your database location. You database location will be something to the effect of $HOME/.aioz depending on your node implemention.

    lz4 -c -d aioz_.tar.lz4  | tar -x -C $HOME/.aioz

IMPORTANT: If you run a validator node and the chain is in halt, it is time to replace the priv_validator_state.json file that you have backed up.

    cp $HOME/.aioz/priv_validator_state.json  $HOME/.aioz/data/priv_validator_state.json

Remove downloaded snapshot to free up space:

    rm aioz_.tar.lz4

ADVANCED ROUTE: The above solution requires you to download the compressed file, uncompressed it and then delete the original file. This requires extra storage space on your server. You can run the following combo command to stream the snapshot into your database location. For advanced users only:

    curl -o - -L https://snapshot-data.aioz.network/aioz_.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.aioz

Running Node

Running node with command:

    aiozd start

If you define home directory to be another path, add flag --home <path-to-directory>

Running via Background Process

To run the node in a background process with automatic restarts, it's recommended to use a service manager like systemd. To set this up run the following: First, export the service name:

    export SERVICE_NAME="aioz"

Then, set up the service with the following commands:

    sudo tee /etc/systemd/system/$SERVICE_NAME.service > /dev/null <<EOF  
    [Unit]
    Description=AIOZ Daemon
    After=network-online.target
    
    [Service]
    User=$USER
    ExecStart=$(which aiozd) start
    Restart=always
    RestartSec=3
    LimitNOFILE=4096
    
    [Install]
    WantedBy=multi-user.target
    EOF

If using Cosmovisor then make sure to add the following after the LimitNOFILE line and replace $(which aiozd) with $(which cosmovisor).

Environment="DAEMON_HOME=$HOME/.aioz"
Environment="DAEMON_NAME=aiozd"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"

Run the following to setup the daemon:

    sudo -S systemctl daemon-reload
    sudo -S systemctl restart systemd-journald
    sudo -S systemctl enable $SERVICE_NAME

Then start the process and confirm that it's running.

    sudo -S systemctl start $SERVICE_NAME   
    sudo service $SERVICE_NAME status

Cosmovisor (optional)

Cosmovisor is a process manager developed to relieve node operators of having to manually intervene every time there is an upgrade. Cosmovisor monitors the governance module for upgrade proposals; it will take care of downloading the new binary, stopping the old one, switching to the new one, and restarting.

For more information on how to run a node via Cosmovisor, check out the docs.

© 2024 AIOZ Network. All rights reserved.