Skip to content

Getting Started

Relevant Source Files

This document provides a complete guide for setting up and running an SN106 Bittensor subnet validator. The validator continuously monitors concentrated liquidity positions across supported blockchains and submits miner weight calculations to the Bittensor network every 20 minutes.

For information about the overall system architecture, see System Architecture. For miner setup instructions, see For Miners. For detailed configuration options, see Configuration.

The SN106 validator requires sufficient computational resources to handle multi-chain data collection and weight calculations.

ComponentMinimumRecommended
CPU4 cores8 cores
RAM8GB16GB
Storage50GB SSD100GB+ SSD
Network50+ Mbps100+ Mbps
OSLinux/macOS/WindowsUbuntu 22.04 LTS
DependencyVersionPurpose
Node.jsv18.0.0+Runtime environment
npmv8.0.0+Package management
GitLatestRepository management

The validator requires RPC access to multiple blockchain networks:

NetworkStatusPurpose
SolanaActiveRaydium CLMM position monitoring
Bittensor SubtensorActiveWeight submission and hotkey management
EthereumComing SoonUniswap V3 integration
BaseComing SoonUniswap V3 integration

Sources: README.md:54-81

flowchart TD
    START["Start Installation"]
    CLONE["git clone repository"]
    INSTALL["npm install"]
    CONFIG["Configure .env file"]
    VALIDATE["Validate configuration"]
    RUN["npm run validator"]
    
    CLONE --> INSTALL
    INSTALL --> CONFIG
    CONFIG --> VALIDATE
    VALIDATE --> RUN
    
    CONFIG --> ENV_EXAMPLE[".env.example template"]
    CONFIG --> ENV_FILE[".env production file"]
    VALIDATE --> CONFIG_TS["config/environment.ts validation"]
    RUN --> VALIDATOR_INDEX["validator/index.ts execution"]
    
    ENV_EXAMPLE -.-> ENV_FILE
    ENV_FILE --> CONFIG_TS
    CONFIG_TS --> VALIDATOR_INDEX

Sources: README.md:84-138

Clone the SN106 repository and install dependencies:

Terminal window
git clone <repository-url>
cd sn106
npm install

The npm install command will install all dependencies defined in package.json, including Bittensor SDK, Solana Web3.js, and other required packages.

Create your environment configuration file:

Terminal window
cp .env.example .env

Edit the .env file with your specific configuration values. The environment template provides the required variable structure.

Sources: README.md:95-102 , .env.example:1-15

The validator requires several categories of environment variables for proper operation:

Terminal window
# Subtensor WebSocket endpoint
SUBTENSOR_WS_URL=wss://your-subtensor-endpoint
# Validator hotkey for weight submission
VALIDATOR_HOTKEY_URI=your-hotkey-uri-or-mnemonic
# Subnet network ID
NETUID=106

The VALIDATOR_HOTKEY_URI supports multiple formats:

  • Mnemonic phrases: word1 word2 word3 ... word12
  • Private keys: 0x1234... (hexadecimal format)
  • URI format: //Alice or other Polkadot-style URIs
Terminal window
# Solana RPC endpoint
SOLANA_RPC_ENDPOINT=https://your-solana-rpc
# Smart contract program IDs
SN106_SVM_PROGRAM_ID=your-program-id
RAYDIUM_CLMM_PROGRAM_ID=your-clmm-program-id
Terminal window
# Execution interval (minutes)
VALIDATOR_INTERVAL_MINUTES=20
# Burn mechanism percentage
BURN_PERCENTAGE=95

The burn mechanism allocates 95% of emissions to the subnet owner (UID 0) and distributes the remaining 5% among miners through a single setWeights transaction.

Sources: README.md:104-132 , .env.example:1-15

flowchart TD
    ENV_FILE[".env file"]
    ENV_VARS["Environment Variables"]
    CONFIG_TS["config/environment.ts"]
    VALIDATION["Runtime Validation"]
    VALIDATOR_START["Validator Startup"]
    ERROR_HANDLING["Configuration Error Handling"]
    
    ENV_FILE --> ENV_VARS
    ENV_VARS --> CONFIG_TS
    CONFIG_TS --> VALIDATION
    VALIDATION --> VALIDATOR_START
    VALIDATION --> ERROR_HANDLING
    
    CONFIG_TS --> SUBTENSOR_CONFIG["Subtensor Configuration"]
    CONFIG_TS --> SOLANA_CONFIG["Solana Configuration"]
    CONFIG_TS --> CHAIN_CONFIG["Multi-Chain Configuration"]
    
    VALIDATION --> HOTKEY_VALIDATION["VALIDATOR_HOTKEY_URI validation"]
    VALIDATION --> RPC_VALIDATION["RPC endpoint validation"]
    VALIDATION --> PROGRAM_ID_VALIDATION["Program ID validation"]
    
    ERROR_HANDLING --> EXIT["Process exit with error"]

Sources: README.md:104-132

Execute the validator using the npm script:

Terminal window
npm run validator

This command starts the validator process defined in validator/index.ts, which initializes the main orchestration loop.

The validator operates on a continuous 20-minute cycle performing the following operations:

flowchart TD
    TIMER["20-minute Timer"]
    START_CYCLE["Start Validation Cycle"]
    DATA_COLLECTION["Multi-Chain Data Collection"]
    WEIGHT_CALC["Weight Calculation"]
    WEIGHT_SUBMISSION["Subtensor Weight Submission"]
    LOGGING["Operation Logging"]
    WAIT["Wait for Next Cycle"]
    
    TIMER --> START_CYCLE
    START_CYCLE --> DATA_COLLECTION
    DATA_COLLECTION --> WEIGHT_CALC
    WEIGHT_CALC --> WEIGHT_SUBMISSION
    WEIGHT_SUBMISSION --> LOGGING
    LOGGING --> WAIT
    WAIT --> TIMER
    
    DATA_COLLECTION --> FETCH_POSITIONS["Fetch NFT Positions"]
    DATA_COLLECTION --> FETCH_TICKS["Fetch Current Ticks"]
    DATA_COLLECTION --> FETCH_HOTKEYS["Fetch Hotkey Mappings"]
    DATA_COLLECTION --> FETCH_ALPHA_PRICES["Fetch Alpha Prices"]
    
    WEIGHT_CALC --> POOL_WEIGHTS["Pool Weight Calculation"]
    WEIGHT_CALC --> NFT_SCORING["NFT Position Scoring"]
    WEIGHT_CALC --> EMA_SMOOTHING["EMA Weight Smoothing"]
    
    WEIGHT_SUBMISSION --> BURN_MECHANISM["95% Burn to UID 0"]
    WEIGHT_SUBMISSION --> MINER_DISTRIBUTION["5% to Miners"]
    WEIGHT_SUBMISSION --> SUBTENSOR_TX["setWeightsOnSubtensor call"]
    
    LOGGING --> WEIGHT_HISTORY["weights/weights_history.json"]
    LOGGING --> CONSOLE_LOGS["Console Output"]

Sources: README.md:140-147

  1. Multi-Chain Position Fetching: Retrieves NFT liquidity positions from enabled chains using getEnabledChains()
  2. Current Tick Analysis: Fetches current market tick data for accurate position scoring
  3. Hotkey-to-UID Mapping: Maps Bittensor hotkeys to subnet UIDs for weight assignment
  4. Alpha Price Monitoring: Collects subnet alpha token prices for performance-based weight allocation
  1. Pool Weight Distribution: Calculates pool-level weight allocation based on alpha token performance
  2. NFT Position Scoring: Evaluates individual NFT positions based on:
    • Position concentration (narrower ranges score higher)
    • Distance from current market price
    • Liquidity amount provided
  3. EMA Smoothing: Applies exponential moving average to prevent weight volatility
  1. Burn Mechanism: Allocates 95% of weights to subnet owner (UID 0)
  2. Miner Distribution: Distributes remaining 5% among qualifying miners
  3. Subtensor Transaction: Submits final weights via setWeightsOnSubtensor

Sources: README.md:140-147

The validator provides comprehensive logging for operational monitoring:

  • Console Output: Real-time operation status and progress indicators
  • Weight History: All weight submissions saved to weights/weights_history.json
  • Error Tracking: Detailed error messages for troubleshooting

The validator includes automatic health monitoring:

  • Connection Monitoring: Automatic detection of RPC connection issues
  • Reconnection Logic: Automatic reconnection for temporary network failures
  • Performance Optimization: Batch processing and multicall operations for efficiency

Monitor these key indicators for validator health:

IndicatorLocationExpected Behavior
Cycle CompletionConsole logsEvery 20 minutes
Weight Submissionsweights/weights_history.jsonSuccessful transactions
Data CollectionConsole outputMulti-chain data retrieval
Error RateConsole logsMinimal connection errors

Sources: README.md:148-154

After successfully starting your validator:

  1. Monitor Initial Cycles: Watch the first few validation cycles to ensure proper operation
  2. Review Weight History: Check weights/weights_history.json for successful submissions
  3. Set Up Monitoring: Implement log monitoring for production environments
  4. Configure Backups: Ensure proper backup systems for validator hotkeys and configuration

For detailed configuration options, see Configuration. For Docker deployment, see Docker Deployment. For validator operation best practices, see For Validators.

Sources: README.md:170-186