Vana DLP Validator Setup Guide

The Vana network uses a novel validator model called Data Liquidity Pools (DLPs) that allows for secure, private data processing. This guide walks you through setting up a DLP validator node on the Vana testnet.

Environment Prerequisites

Before proceeding with the validator setup, ensure your system has the following components installed:

  • Git: For repository management
  • Python 3.11+: Core requirement for the Vana validator software
  • Poetry: Python dependency management tool
  • Metamask: Or another EVM-compatible wallet for test tokens
If you're planning to create a new DLP (rather than just participating as a validator), you'll also need Node.js and npm.

Step 1: Environment Setup

Python 3.11 Installation

First, install Python 3.11 and related packages:

sudo apt update
sudo apt install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.11 python3.11-venv python3.11-dev python3-pip

python3.11 --version

Poetry Setup

Install Poetry for Python dependency management:

curl -sSL https://install.python-poetry.org | python3 -

echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bash_profile
source $HOME/.bash_profile
poetry --version

Node.js & npm Installation

Install Node Version Manager (nvm) and the latest LTS version of Node.js:

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.bash_profile
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm' >> $HOME/.bash_profile
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion' >> $HOME/.bash_profile

source $HOME/.bash_profile

# Install Node.js LTS version
nvm install --lts

# Verify installation
node -v
npm -v

Step 2: Validator Software Setup

Clone Repository

Clone the Vana DLP ChatGPT repository:

git clone https://github.com/vana-com/vana-dlp-chatgpt.git
cd vana-dlp-chatgpt

Install Dependencies

Install the required Python dependencies using Poetry:

poetry install

Install Vana CLI

Install the Vana command-line interface:

pip install vana

Step 3: Wallet Configuration

Create Wallet

Create a new wallet with both cold and hot keys:

vanacli wallet create --wallet.name default --wallet.hotkey default
This command creates two key pairs - a coldkey for human-managed transactions like staking, and a hotkey for validator operations. Make sure to securely save the mnemonic phrases; they're your only way to recover the wallet.

Configure MetaMask for Testnet

Add the Vana Moksha Testnet to your MetaMask wallet with these parameters:

Features

Network Settings

Export and Import Keys

Export your private keys from the Vana CLI:

# Export coldkey
vanacli wallet export_private_key

# Export hotkey
vanacli wallet export_private_key

Import these keys to MetaMask:

  1. Open MetaMask and click your account icon
  2. Select "Import Account"
  3. Choose "Private Key" as the import method
  4. Paste your coldkey private key
  5. Repeat for your hotkey

Fund Your Accounts

Both your coldkey and hotkey addresses need testnet VANA tokens:

  1. Visit the Vana Testnet Faucet
  2. Connect your MetaMask wallet
  3. Request VANA for both addresses
The faucet has a daily limit. If you need more tokens, you may need to ask other VANA holders for testnet tokens.

Step 4: Creating a DLP (For DLP Creators Only)

Generate Encryption Keys

Run the key generation script:

./keygen.sh

Follow the prompts to enter your name, email, and key expiration details. This will generate four files:

  • public_key.asc and public_key_base64.asc (for UI)
  • private_key.asc and private_key_base64.asc (for validators)

Deploy DLP Smart Contracts

Clone the DLP Smart Contract repository:

cd $HOME
rm -rf vana-dlp-smart-contracts
git clone https://github.com/Josephtran102/vana-dlp-smart-contracts
cd vana-dlp-smart-contracts

Install Yarn and dependencies:

npm install -g yarn
yarn --version

yarn install

Configure the environment:

cp .env.example .env
nano .env

Deploy the contracts to the Moksha testnet:

npx hardhat deploy --network moksha --tags DLPDeploy

Update the environment settings in the DLP ChatGPT directory:

nano ~/vana-dlp-chatgpt/.env

Add these configuration values:

# The network to use, currently Vana Moksha testnet
OD_CHAIN_NETWORK=moksha
OD_CHAIN_NETWORK_ENDPOINT=https://rpc.moksha.vana.org

# Optional: OpenAI API key for additional data quality check
OPENAI_API_KEY="sk-aIKhy1wmK6Vfx.............._CIJvZx7uZl2HjAA"

# Optional: Your own DLP smart contract address once deployed to the network, useful for local testing
DLP_MOKSHA_CONTRACT=0x5cb.......eE04

# Optional: Your own DLP token contract address once deployed to the network, useful for local testing
DLP_TOKEN_MOKSHA_CONTRACT=0x69e..........2741

# The private key for the DLP, follow "Generate validator encryption keys" section in the README
PRIVATE_FILE_ENCRYPTION_PUBLIC_KEY_BASE64="LS0tLS1CRUdJTiB..........g=="
You'll need to replace the placeholder values with your actual contract addresses and keys. The OPENAI_API_KEY can be obtained from OpenAI's API dashboard. For PRIVATE_FILE_ENCRYPTION_PUBLIC_KEY_BASE64, use the content of the public_key_base64.asc file located at /root/vana-dlp-chatgpt/public_key_base64.asc.

Step 5: Validator Setup and Registration

Prepare Your Environment

Ensure you're in the correct directory:

cd ~
cd vana-dlp-chatgpt

Fund Validator with DLP Tokens

For DLP creators:

  1. Import your DLP token to MetaMask using the DataLiquidityPoolToken address
  2. Send 10 of your DLP tokens to both your coldkey and hotkey addresses

For validators joining an existing DLP:

  1. Request DLP tokens from the DLP creator
  2. Ensure they are in your coldkey address

Register as a Validator

Register your validator with the network:

./vanacli dlp register_validator --stake_amount 10

Approve your validator (using your hotkey address from MetaMask):

./vanacli dlp approve_validator --validator_address=<your hotkey address from Metamask>

Run the Validator

Start the validator process:

poetry run python -m chatgpt.nodes.validator

Step 6: Creating a Systemd Service

For continuous operation, set up a systemd service:

Find the path to Poetry:

echo $(which poetry)

Create the service file:

sudo tee /etc/systemd/system/vana.service << EOF
[Unit]
Description=Vana Validator Service
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/vana-dlp-chatgpt
ExecStart=/root/.local/bin/poetry run python -m chatgpt.nodes.validator
Restart=on-failure
RestartSec=10
Environment=PATH=/root/.local/bin:/usr/local/bin:/usr/bin:/bin:/root/vana-dlp-chatgpt/myenv/bin
Environment=PYTHONPATH=/root/vana-dlp-chatgpt

[Install]
WantedBy=multi-user.target
EOF

Enable and start the service:

sudo systemctl daemon-reload && \
sudo systemctl enable vana.service && \
sudo systemctl start vana.service && \
sudo systemctl status vana.service

Monitor the validator logs:

sudo journalctl -u vana.service -f
Congratulations! You should now have a running DLP validator on the Vana testnet. Your validator will participate in the network's operations, validating data and transactions while maintaining privacy and security through the DLP architecture.

Troubleshooting

If you encounter issues, check the following:

  1. Ensure your MetaMask has sufficient VANA tokens
  2. Verify that your .env file has the correct contract addresses
  3. Check the validator logs for any error messages
  4. Make sure your system meets all the hardware and software requirements
  5. Confirm that your keys have been properly generated and imported