Skip to content

PoS Validator

Vana banner

PoS Validator Setup

https://docs.vana.org/vana/core-concepts/roles/propagators

1. Prerequisites

You need to submit deposits for each validator at least 35,000 VANA on Moksha testnet. This process stakes your VANA and registers your validator(s) with the network

Hardware requirements for Testnet
  • 2-core CPU
  • 8 GB RAM
  • 100 GB high-speed SSD
  • x86-64 architecture

These hardware requirements are rough guidelines, and each node operator should monitor their node to ensure good performance for the intended task.

Terminal window
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker version
banner banner
Terminal window
VER=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)
curl -L "https://github.com/docker/compose/releases/download/"$VER"/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
banner
  • OpenSSL: Install via your package manager:
Terminal window
sudo apt-get install openssl
banner
2. Clone the repository:
Terminal window
git clone https://github.com/vana-com/vana.git
cd vana
banner
3. Configure your environment:
Terminal window
cp .env.moksha.example .env

Edit .env with your preferred text editor

Terminal window
nano .env
banner
4. Choose your setup:
a. For running a node without a validator:

Edit the .env file to set the USE_VALIDATOR variable to false. It is recommended to use GETH_SYNCMODE=snap and to update the Prysm variables to match, per the comments in the .env.example file. Then run the following commands:

Terminal window
docker compose --profile init --profile node up -d
b. For running a validator node:

Edit the .env file to set the USE_VALIDATOR variable to true and set the DEPOSIT_* variables to the appropriate values. Then run the following commands:

  • Generate validator keys (interactive process):
Terminal window
docker compose --profile init --profile manual run --rm validator-keygen
banner

Setting an Eth1 address as your withdrawal address:

  • Create a password that secures your validator keystore(s):
banner
  • Save your mnemonic carefully:
banner
  • Verify your mnemonic phrase
banner banner
Check config:
Terminal window
docker compose logs check-config
banner
Start all services including the validator:
Terminal window
docker compose --profile init --profile validator up -d
banner
View logs for specific key services:
Terminal window
docker compose --profile=init --profile=node logs -f geth
docker compose --profile=init --profile=node logs -f beacon
docker compose --profile=init --profile=node logs -f validator
banner banner

Wait for beacon chain full synced

banner banner
Submit deposits for your validator

You need to submit deposits for each validator at least 35,000 VANA on Moksha testnet. This process stakes your VANA and registers your validator(s) with the network

Terminal window
docker compose --profile init --profile manual run --rm submit-deposits
banner
Check block sync left:
Terminal window
LOCAL_RPC="http://localhost:$(grep HTTP_PORT ~/vana/.env | cut -d '=' -f2)"
REMOTE_RPC="https://rpc-moksha-vana.josephtran.xyz/"
get_block_number() {
curl -s -X POST "$1" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | \
jq -r '.result' | \
xargs -I{} printf "%d" {}
}
while true; do
local_height=$(get_block_number $LOCAL_RPC)
network_height=$(get_block_number $REMOTE_RPC)
blocks_left=$((network_height - local_height))
echo -e "\033[1;38mYour node height:\033[0m \033[1;34m$local_height\033[0m | \033[1;35mNetwork height:\033[0m \033[1;36m$network_height\033[0m | \033[1;29mBlocks left:\033[0m \033[1;31m$blocks_left\033[0m"
sleep 5
done
banner

# Advanced Usage

The docker-compose.yml file provides several additional capabilities for managing your Vana PoS validator node. Here are some useful commands and their purposes:

Profiles

Different profiles are available for various operations:

  • init: Initialize clients, generate secrets
  • node: Run the main node services
  • validator: Run validator-specific services
  • manual: For manual operations like key generation
  • delete: Delete data, e.g. to reset the chain so you can re-sync

You can combine profiles as needed. Whenever a service depends on another service, you must include the dependent profile.

For example, to start the node, you must include the init and node profiles:

Terminal window
#Start node
docker compose --profile init --profile node up -d
Terminal window
#Stop node
docker compose --profile init --profile node down
Key Management

Generate validator keys (interactive process):

Terminal window
docker compose --profile init --profile manual run --rm validator-keygen

Import validator keys:

Terminal window
docker compose run --rm validator-import
Deleting Data

To delete all data/ (does not remove generated secrets/):

Terminal window
docker compose --profile delete run --rm delete-all

To delete execution or consensus layer data:

Terminal window
docker compose --profile delete run --rm delete-geth
docker compose --profile delete run --rm delete-prysm
Configuration Check

Run a configuration check:

Terminal window
docker compose --profile=init --profile=node run --rm check-config
Individual Services

You can start, stop, or restart individual services:

Terminal window
docker compose --profile=init --profile=node up -d geth
docker compose --profile=init --profile=node stop beacon
docker compose --profile=init --profile=node restart validator
Viewing Logs

View logs for specific services:

Terminal window
docker compose --profile=init --profile=node logs geth
docker compose --profile=init --profile=node logs beacon
docker compose --profile=init --profile=node logs validator

Add -f to follow the logs in real-time:

Terminal window
docker compose --profile=init --profile=node logs -f geth

Use grep to filter for specific events:

Terminal window
docker compose --profile=init --profile=node logs -f geth 2>&1 | grep 'Looking for peers'
docker compose --profile=init --profile=node logs -f beacon 2>&1 | grep 'Synced new block'
docker compose --profile=init --profile=node logs -f validator 2>&1 | grep 'Submitted new'