Skip to main content

Setting up a Magma Lava testnet node can be an exciting way to contribute to the network’s growth and stability. This guide simplifies the process, ensuring that even those new to node operation can successfully set up their node. Let’s dive in!

Prerequisites:

  • Hardware Requirements: Ensure your setup meets the recommended specifications for running a testnet node:
    • RAM: 16GB
    • Storage: 512GB SSD
    • CPU: x64 2.0 GHz 4v CPU
  • Operating System: Ubuntu 20 or newer.
  • Network Configurations: Open ports 1317 (REST), 26657 (Tendermint RPC), and 26656 (Cosmos).

Step 1: Prepare Your System

  1. Update and Install Dependencies
    Open a terminal and execute:

    sudo apt update
    sudo apt install -y unzip logrotate git jq sed wget curl coreutils systemd
  2. Create a Temporary Installation Directory
    temp_folder=$(mktemp -d) && cd "$temp_folder"
    

Step 2: Install Go

  1. Download and Install Go
    Set the Go package URL and file name, then download and unpack:

    go_package_url="https://go.dev/dl/go1.20.5.linux-amd64.tar.gz"
    go_package_file_name=${go_package_url##*/}
    wget -q "$go_package_url"
    sudo tar -C /usr/local -xzf "$go_package_file_name"
    
  2. Set Up Your Environment
    Add Go to your PATH in ~/.profile:

    echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.profile
    echo "export PATH=\$PATH:\$(go env GOPATH)/bin" >> ~/.profile
    source ~/.profile
    

Step 3: Install and Configure Your Magma Lava Node

  1. Clone the Lava Configuration Repository
    git clone https://github.com/lavanet/lava-config.git
    cd lava-config/testnet-2
    source setup_config/setup_config.sh
  2. Set Up Application Configurations
    Copy default config files to your Lava config folder:

    mkdir -p "$lavad_home_folder"
    mkdir -p "$lava_config_folder"
    cp default_lavad_config_files/* "$lava_config_folder"

Step 4: Initialise Your Node

  1. Set the Genesis File
    Copy the genesis.json file to your config folder:

    cp genesis_json/genesis.json "$lava_config_folder"/genesis.json
  2. Install Cosmovisor for Automated Upgrades
    go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]
    mkdir -p "$lavad_home_folder"/cosmovisor/genesis/bin/
    wget -O "$lavad_home_folder"/cosmovisor/genesis/bin/lavad "https://github.com/lavanet/lava/releases/download/v0.21.1.2/lavad-v0.21.1.2-linux-amd64"
    chmod +x "$lavad_home_folder"/cosmovisor/genesis/bin/lavad
    

Step 5: Configure and Start Cosmovisor

  1. Set Environment Variables
    Add the following lines to ~/.profile and reload it:

    echo "# Setup Cosmovisor" >> ~/.profile
    echo "export DAEMON_NAME=lavad" >> ~/.profile
    echo "export CHAIN_ID=lava-testnet-2" >> ~/.profile
    echo "export DAEMON_HOME=\$HOME/.lava" >> ~/.profile
    echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.profile
    echo "export DAEMON_LOG_BUFFER_SIZE=512" >> ~/.profile
    echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.profile
    echo "export UNSAFE_SKIP_BACKUP=true" >> ~/.profile
    source ~/.profile
    
  2. Initialise and Start Your Node
    Initialise your node with your chosen node name:

    "$lavad_home_folder"/cosmovisor/genesis/bin/lavad init my-node --chain-id lava-testnet-2 --home "$lavad_home_folder" --overwrite
    

    Create and start the Cosmovisor service:

    sudo systemctl daemon-reload
    sudo systemctl enable cosmovisor.service
    sudo systemctl restart systemd-journald
    sudo systemctl start cosmovisor.service
    

Step 6: Verify Your Node

  • Check Service Status
    sudo systemctl status cosmovisor
    
  • Monitor Logs
    sudo journalctl -u cosmovisor -f
    
  • Verify Node Status
    $HOME/.lava/cosmovisor/current/bin/lavad status | jq .SyncInfo.catching_up
    

Congratulations! You’ve successfully set up your Magma Lava testnet node. Engage with the Lava community on Discord for support and stay updated with the latest developments.