Guide - Validator

Requirements for running a validator

  • Openrouter API Key

  • Deploy the synthetic QA API on the same server as the validator

Setup the Synthetic QA API Server

  1. Start a redis server

# You can use the template provided in this project to start a redis server, feel free to modify the commands below and the docker-compose file to suit your needs
mkdir /opt/redis
cp docker-compose.yaml /opt/redis
echo "--requirepass <change_me>" > /opt/redis/redis.conf
cd /opt/redis && docker compose up -d

# TODO: Start with binary etc
  1. Clone the Synthetic QA API Server project

cd /opt

# git clone synthetic qa api server
git clone https://github.com/tensorplex-labs/synthetic-qa-api.git
cd synthetic-qa-api

# Set up python virtual environment and pip packages
python -m venv env
env/bin/pip install -r requirements.txt --no-cache-dir
  1. Setup .env file

# copy .env.example
cp .env.example .env

# edit the .env file with vim, vi or nano
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_USERNAME=default
REDIS_PASSWORD=<PASSWORD>
OPENROUTER_API_KEY=sk-or-v1-<KEYS>
# optional, depending on what provider is being used at the moment
TOGETHER_API_KEY=
OPENAI_API_KEY=
  1. Deploy the synthetic QA API Server

# start the api server with pm2
pm2 start "uvicorn main:app --host 127.0.0.1 --port 5003 --workers 4" --name dojo-synthetic-api

5. Start Validating

Head back to dojo-subnet project and set up the .env file

cd dojo-subnet

# copy .env.validator.example
cp .env.validator.example .env

# edit the .env file with vim, vi or nano
# Please select one
DOJO_API_BASE_URL="https://dojo-api-dev.tensorplex.dev" | "https://dojo-api.tensorplex.dev" | "https://dojo-api.tensorplex.ai"
SYNTHETIC_API_URL="http://127.0.0.1:5003"
TOKENIZERS_PARALLELISM=true
OPENROUTER_API_KEY="sk-or-v1-<KEY>"
WANDB_API_KEY="<wandb_key>"

# Optional or if you've chosen it
TOGETHER_API_KEY=
OPENAI_API_KEY=
  1. Start the validator

# start the validator
# Devnet
pm2 start main_validator.py \
--name dojo-validator \
--interpreter env/bin/python3 \
-- --netuid 1 \
--wallet.name coldkey \
--wallet.hotkey hotkey \
--logging.debug \
--axon.port 9603 \
--neuron.type validator \
--scoring_method "dojo" \
--subtensor.network ws://13.213.1.80:9946

# Testnet
pm2 start main_validator.py \
--name dojo-validator \
--interpreter env/bin/python3 \
-- --netuid 98 \
--wallet.name coldkey \
--wallet.hotkey hotkey \
--logging.debug \
--axon.port 9603 \
--neuron.type validator \
--scoring_method "dojo" \
--subtensor.network test
  1. To start with autoupdate for validators (optional)

# Devnet
pm2 start run.sh \
--interpreter bash \
--name dojo-autoupdater \
-- --wallet.name coldkey \
--wallet.hotkey hotkey \
--logging.debug \
--subtensor.network ws://13.213.1.80:9946 \
--neuron.type validator \
--scoring_method "dojo" \
--axon.port 9603

# Testnet
pm2 start run.sh \
--interpreter bash \
--name dojo-autoupdater \
-- --wallet.name coldkey \
--wallet.hotkey hotkey \
--logging.debug \
--subtensor.network test \
--neuron.type validator \
--scoring_method "dojo" \
--axon.port 9603

Last updated