How mode-network/synth-subnet works
Main Components
• Miners: Represented by code in directories such as synth/miner, neurons/miner, and miner.config*. They’re responsible for generating multiple simulated price paths per prompt.
• Validators: Implemented in synth/validator and neurons/validator. They receive miner predictions, validate them, calculate CRPS scores (and additional moving average/softmax calculations), and then determine leaderboard scores and emissions.
• API Layer: Located under synth/api; this layer exposes endpoints for receiving inputs, distributing prompts to miners, and handling miner responses.
• Business Logic & Simulation Engine: The core simulation and scoring functions reside in the synth/base, synth/simulation_input, and associated utility modules. This encapsulates forecast generation, the CRPS scoring algorithm, and the moving-average leaderboarding.
• Database Layer: The synth/db folder (along with Alembic migrations in the alembic folder) shows that the application persists historical predictions, scores, and configuration data.
• External Integrations:
• Pyth Oracle: Used by both miners and validators to obtain real price data at a given start time.
• Bittensor Network: The computed final weights are sent over to Bittensor.
• Auxiliary Modules:
• “dca” and “neurons” provide supplementary services which may handle staking, additional prediction utilities, or other data processing.
• “verify” likely represents scripts used for supplementary verification of predictions or permits.
• Infrastructure & Deployment: Dockerfile(s), docker-compose.yaml, and CI/CD configurations (.github/workflows) indicate containerized deployment and automated testing/integration practices.
Relationships and Interactions
• The Validator sends a request (with input prompts detailing parameters such as asset, start_time, time_increment, etc.) to a Miner.
• The Miner generates predictions (an ensemble of price paths) and sends them back.
• The Validator then runs its own validation functions. In case of errors, it stores error logs; otherwise, it stores the validated results in the Database (or “Storage”).
• Post-processing includes retrieving past scores, applying an exponentially decaying time-weighted average, performing softmax normalization, and finally sending the final emission weights to Bittensor.
• External Price Provider (Pyth Oracle) and the Bittensor network with clear one-way and two-way communications where applicable.
Architectural Patterns and Design Principles
• Layered Architecture: Different layers (API, business logic, database, external services) are separated, which eases maintenance and scalability.
• Microservice-ish Interaction: Although all within one repository, components are modular (miners, validators, API, database) and communicate via clear interfaces.
• Containerization & CI/CD: With Dockerfiles, docker-compose, and GitHub workflows, the project emphasizes reproducible environments and continuous integration.
Technologies & Frameworks
• Python: The primary language for simulation, scoring, and backend logic.
• NodeJS: Evident from the miner/validator config JavaScript files and PM2 process manager.
• Docker: For containerization.
• Alembic & SQLAlchemy (implied by folder names and migration files): For database schema management.
• Rust & pkg-config: For any performance-critical parts or additional tooling.
• External dependency integration (Pyth Oracle and Bittensor).