# Run a Full Node

This document provides instructions for running a full node for a live network (either Regen Mainnet, Redwood Testnet, or Hambach Testnet).

The following instructions assume that you have already completed the following:

# Quickstart

If you would like to manually set up a full node, skip to the next section. Alternatively, you can run the following quickstart script:

bash <(curl -s https://raw.githubusercontent.com/regen-network/mainnet/blob/main/scripts/mainnet-val-setup.sh)

# Initialize Node

Create the configuration files and data directory by initializing the node. In the following command, replace [moniker] with a name of your choice.

For Regen Mainnet:

regen init [moniker] --chain-id regen-1

For Redwood Testnet:

regen init [moniker] --chain-id regen-redwood-1

For Hambach Testnet:

regen init [moniker] --chain-id regen-hambach-1

# Update Genesis

Update the genesis file.

For Regen Mainnet:

curl http://mainnet.regen.network:26657/genesis | jq .result.genesis > ~/.regen/config/genesis.json

For Redwood Testnet:

curl http://redwood.regen.network:26657/genesis | jq .result.genesis > ~/.regen/config/genesis.json

For Hambach Testnet:

curl http://hambach.regen.network:26657/genesis | jq .result.genesis > ~/.regen/config/genesis.json

# Update Peers

Add a seed node for initial peer discovery.

For Regen Mainnet:

sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' ~/.regen/config/config.toml

For Redwood Testnet:

sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' ~/.regen/config/config.toml

For Hambach Testnet:

sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' ~/.regen/config/config.toml

# Start Node

At this point, the node is ready. If you do not need to run a dedicated full node in a separate process, you can start the node using the regen binary.

Start node:

regen start

# Set Genesis Binary

Create the folder for the genesis binary and copy the regen binary:

mkdir -p $HOME/.regen/cosmovisor/genesis/bin
cp $GOBIN/regen $HOME/.regen/cosmovisor/genesis/bin

# Cosmovisor Service

The next step will be to configure cosmovisor as a systemd service. For more information about the environment variables used to configure cosmovisor, see Cosmovisor (opens new window).

Create the cosmovisor.service file:

echo "[Unit]
Description=Cosmovisor daemon
ExecStart=${GOBIN}/cosmovisor start
" >cosmovisor.service

Move the file to the systemd directory:

sudo mv cosmovisor.service /lib/systemd/system/cosmovisor.service

Reload systemctl and start cosmovisor:

sudo systemctl daemon-reload
sudo systemctl start cosmovisor

Check the status of the cosmovisor service:

sudo systemctl status cosmovisor

Enable cosmovisor to start automatically when the machine reboots:

sudo systemctl enable cosmovisor.service

# Using StateSync

Regen Mainnet and Redwood Testnet also support statesync (opens new window) which allows node operators to quickly spin up a node without downloading the existing chain data. It should be noted that not many nodes should be spun up on the network using this method as these nodes will be unable to propogate the historical data to other nodes.

Download and execute the script for Regen Mainnet:

export MONIKER=<your-node-moniker>
curl -s -L https://raw.githubusercontent.com/regen-network/regen-ledger/master/scripts/statesync.bash | bash -s $MONIKER

Download and execute the script for Redwood Testnet:

export MONIKER=<your-node-moniker>
curl -s -L https://raw.githubusercontent.com/regen-network/testnets/master/scripts/testnet-statesync.bash | bash -s $MONIKER

# Prepare Upgrade

The next step will be to create a validator and prepare your node for the upgrade process.