Full node step-by-step

Full Node Setup

This section details the setup procedure for a full node. If you intend to run a validator node, please see the Validator setup guide instead.

Prerequisites

  • A machine that meets the requirements for a full node
  • An associated public IPv4 address with port 26656 reachable from anywhere for P2P connections
  • You have already installed Namada and its prerequisites
  • You know the unique chain-id identifier of the network you wish to join. The chain-id is publicly released once the genesis files have been prepared

Join the network

Once the chain-id has been distributed, it is possible to join the network with the CHAIN_ID. This step will download the .tar.gz archive containing the genesis files for the chain and initialize the node store in your BASE_DIR.

  export CHAIN_ID="namada-mainnet" ## (replace with the actual chain-id)
  namada client utils join-network --chain-id $CHAIN_ID --add-persistent-peers
💡

You can specify the location from which to download the genesis .tar.gz by exporting the environment variable NAMADA_NETWORK_CONFIGS_SERVER prior to running the join-network command. This is useful for joining a community-run or local testnet.

By default, join-network will attempt to download the genesis files from https://github.com/heliaxdev/anoma-network-config/releases/download/$CHAIN_ID.

Check/Update persistent peers

To sync block data, your node will need to connect with existing peers on the network. Peer addresses can be provided in the node's configuration in the field persistent_peers.

Your persistent_peers entry will need to contain at least one peer which is active and accepting incoming connections (the more, the better). If you used the --add-persistent-peers flag during the join-network step, your persistent peers will be pre-populated with the addresses of the genesis validators. However, if you're having trouble syncing, you may wish to check the Discord server for an updated list.

Start your node and sync

This command will start syncing your node with the network (an environment variable is being used here to set the logging configuration):

  CMT_LOG_LEVEL=p2p:none,pex:error namada node ledger run

Optional: If you want more logs, you can instead run

NAMADA_LOG=info CMT_LOG_LEVEL=p2p:none,pex:error NAMADA_CMT_STDOUT=true namada node ledger run

And if you want to save your logs to a file, you can instead run:

TIMESTAMP=$(date +%s)
NAMADA_LOG=info CMT_LOG_LEVEL=p2p:none,pex:error NAMADA_CMT_STDOUT=true namada node ledger run &> logs-${TIMESTAMP}.txt
tail -f -n 20 logs-${TIMESTAMP}.txt ## (in another shell)

Done!

You should soon see messages similar to the following in your logs to indicate that your node has begun syncing blocks:

INFO namada_node::shell: Committed block hash: 0c56ebc5ae17ef503c675ad8a9b255e69258e7e4915f91e161f98d3b0040a0c1, height: 2650
committed state                              module=state height=2650 num_txs=0 app_hash=0C56EBC5AE17EF503C675AD8A9B255E69258E7E4915F91E161F98D3B0040A0C1
indexed block exents                         module=txindex height=2650

You can also easily check your node's last committed block with the following command:

# namadac block
Last committed block height: 8612, time: 2024-06-04T18:17:06.136117438+00:00

By comparing it with the current height of the chain from a public source (such as a block explorer), you can monitor how your node is progressing.

If your node does not show indications of syncing, proceed to the troubleshooting section.

Running the namada ledger as a systemd service

The below script is a community contribution by Encipher88, and currently only works on Ubuntu machines. It has served useful for many validators.

For operators using Ubuntu, it is common to use the systemd service manager to run the ledger process in the background. Advantages of this method include automatic restart upon crash and integrated logging.

The below assumes you have installed namada from source, with make install. It at least assumes the respective binaries are in /usr/local/bin/.

which namada ## (should return /usr/local/bin/namada)

We define a new process as a systemd service by creating a unit file in /etc/systemd/system/:

sudo tee /etc/systemd/system/namadad.service > /dev/null <<EOF
[Unit]
Description=namada
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.local/share/namada
Environment=CMT_LOG_LEVEL=p2p:none,pex:error
Environment=NAMADA_CMT_STDOUT=true
ExecStart=/usr/local/bin/namada node ledger run 
StandardOutput=syslog
StandardError=syslog
Restart=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Enable the service with the below commands. This sets the service to start automatically on system reboot.

sudo systemctl daemon-reload
sudo systemctl enable namadad

Now you can manage the node through systemd commands:

  • Run the node
sudo systemctl start namadad
  • Stop the node
sudo systemctl stop namadad
  • Restart the node
sudo systemctl restart namadad
  • Show node logs
sudo journalctl -u namadad -f -o cat