# Running a Full Node

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

# Prerequisites

In order to install the cosmovisor and regen binaries, you'll need the following:

  • Git >=2
  • Make >=4
  • Go >=1.17

For more information (including hardware recommendations), see Prerequisites.

# 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)

# Install Regen

Clone the regen-ledger repository:

git clone https://github.com/regen-network/regen-ledger

Change to the regen-ledger directory:

cd regen-ledger

Check out the version that the network launched with.

For Regen Mainnet:

git checkout v1.0.0

For Redwood Testnet:

git checkout v1.0.0

For Hambach Testnet:

git checkout v2.0.0-beta1

Install the regen binary (the EXPERIMENTAL option enables experimental features).

For Regen Mainnet:

make install

For Redwood Testnet:

make install

For Hambach Testnet:

EXPERIMENTAL=true make install

Check to ensure the install was successful:

regen version

# 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://104.131.169.70: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:

PERSISTENT_PEERS="69975e7afdf731a165e40449fcffc75167a084fc@104.131.169.70:26656"
sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' ~/.regen/config/config.toml

For Redwood Testnet:

PERSISTENT_PEERS="a5528d8f5fabd3d50e91e8d6a97e355403c5b842@redwood.regen.network:26656"
sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' ~/.regen/config/config.toml

For Hambach Testnet:

PERSISTENT_PEERS="4f5c0be7705bf4acb5b99dcaf93190059ac283a1@hambach.regen.network:26656"
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

# Install Cosmovisor

Cosmovisor (opens new window) is a process manager for running application binaries. Using Cosmovisor is not required but recommended for node operators that would like to automate the upgrade process.

To install cosmovisor, run the following command:

go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0

Check to ensure the install was successful:

cosmovisor version

# 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
After=network-online.target
[Service]
Environment="DAEMON_NAME=regen"
Environment="DAEMON_HOME=${HOME}/.regen"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
User=${USER}
ExecStart=${GOBIN}/cosmovisor start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
" >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

# Prepare Upgrade

The next step will be to prepare your node for the upgrade process. See Upgrade Guide v2.0 for more information.