### Install Development Dependencies and Pre-commit Hooks Source: https://github.com/mode-network/synth-subnet/blob/main/README.md Installs the necessary development dependencies from requirements-dev.txt and sets up pre-commit hooks for code quality checks. This is essential for developers contributing to the project. ```shell pip install -r requirements-dev.txt pre-commit install ``` -------------------------------- ### Git Log Output Example Source: https://github.com/mode-network/synth-subnet/blob/main/contrib/STYLE.md An example of a well-formatted git log entry showing the separation between the subject line and the explanatory body. ```text commit 42e769bdf4894310333942ffc5a15151222a87be Author: Kevin Flynn Date: Fri Jan 01 00:00:00 1982 -0200 Derezz the master control program MCP turned out to be evil and had become intent on world domination. This commit throws Tron's disc into MCP (causing its deresolution) and turns it back into a chess game. ``` -------------------------------- ### Install Python Project Dependencies Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Installs all Python dependencies listed in the 'requirements.txt' file within the active virtual environment. This command should be run after activating the virtual environment. ```shell pip install -r requirements.txt ``` -------------------------------- ### Install Rust Programming Language Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Downloads and installs the Rust programming language and its package manager, Cargo, using the official installation script. Rust is a key dependency for the project. ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Git Commit Body Example (Bitcoin Core) Source: https://github.com/mode-network/synth-subnet/blob/main/contrib/STYLE.md An example of a well-structured Git commit message body from the Bitcoin Core project, explaining the 'what' and 'why' of a change. ```git commit eb0b56b19017ab5d69d39c53126924ed6 Author: Pieter Wuille Date: Fri Aug 1 22:57:55 2014 +0200 Simplify serialize.h's exception handling Remove the 'state' and 'exceptmask' from serialize.h's stream implementations, as well as related methods. As exceptmask always included 'failbit', and setstate was always called with bits = failbit, all it did was immediately raise an exception. Get rid of those variables, and replace the setstate with direct exception throwing (which also removes some dead code). As a result, good() is never reached after a failure (there are only 2 calls, one of which is in tests), and can just be replaced by !eof(). fail(), clear(n) and exceptions() are just never called. Delete them. ``` -------------------------------- ### Launch Miner with PM2 Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_tutorial.md Starts the miner process using a PM2 configuration file. Requires a pre-configured miner.local.config.js file. ```shell pm2 start miner.local.config.js ``` -------------------------------- ### Install System Dependencies Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Updates the package list and installs essential system dependencies including Node.js, npm, Python 3.11, and pkg-config. These are required for building and running the project. ```shell sudo apt update && sudo apt install nodejs npm python3.11 pkg-config ``` -------------------------------- ### Deploy Validator via Docker Source: https://context7.com/mode-network/synth-subnet/llms.txt Commands to configure environment variables, install Docker, and launch the validator stack using docker-compose. ```bash cp .env.validator .env.validator.local curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER newgrp docker docker compose up --build --remove-orphans --force-recreate -d ``` -------------------------------- ### Git Commit Examples (Imperative Mood) Source: https://github.com/mode-network/synth-subnet/blob/main/contrib/STYLE.md Demonstrates Git's use of the imperative mood in automatically generated commit messages and provides examples of well-formed commit subject lines. ```git Merge branch 'myfeature' ``` ```git Revert "Add the thing with the stuff" This reverts commit cc87791524aedd593cff5a74532befe7ab69ce9d. ``` ```git Merge pull request #123 from someuser/somebranch ``` ```git Refactor subsystem X for readability ``` ```git Update getting started documentation ``` ```git Remove deprecated methods ``` ```git Release version 1.0.0 ``` -------------------------------- ### Install PM2 Process Manager Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Installs PM2, a production process manager for Node.js applications, globally on the system using npm. PM2 is used for managing the validator process. ```shell sudo npm install pm2 -g ``` -------------------------------- ### Docker Deployment and Management for Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Provides commands for deploying and managing the validator using Docker and Docker Compose. This includes setting up environment variables, starting the validator, updating it, and viewing logs. ```shell cp .env.validator .env.validator.local ``` ```shell curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo groupadd docker sudo usermod -aG docker $USER newgrp docker ``` ```shell docker compose up --build --remove-orphans --force-recreate -d ``` ```shell docker compose logs -f ``` -------------------------------- ### Install Python Virtual Environment Package Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Installs the 'venv' module for Python 3.11, which is used to create isolated Python environments. This ensures project dependencies do not conflict with system-wide packages. ```shell sudo apt install python3.11-venv ``` -------------------------------- ### Configure Bittensor Logging Level (Info) Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Enables Bittensor's info-level logging. This can be set via a PM2 configuration file or directly on the command line when starting a process. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--logging.info", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --logging.info ``` -------------------------------- ### Git Commit Command Usage Source: https://github.com/mode-network/synth-subnet/blob/main/contrib/STYLE.md Examples of using the git commit command with the -m flag for simple, descriptive messages. ```bash git commit -m "Fix typo in README file" git commit -m "Fix typo in introduction to user guide" ``` -------------------------------- ### Run Bittensor Validator with PM2 Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Starts the validator service using PM2 process manager. Configuration files are used to define the validator's behavior and network settings. Includes options for mainnet and testnet. ```shell pm2 start validator.config.js ``` ```shell pm2 start validator.test.config.js ``` -------------------------------- ### Configure Bittensor Logging Level (Trace) Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Enables Bittensor's trace-level logging for detailed debugging. This can be configured using a PM2 setup or directly via the command line. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--logging.trace", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --logging.trace ``` -------------------------------- ### Query Miner Validation API Source: https://context7.com/mode-network/synth-subnet/llms.txt Example curl command to check the validation status of a specific miner UID. ```bash curl "https://api.synthdata.co/validation/miner?uid=123" ``` -------------------------------- ### Define Simulation Input Parameters (Python) Source: https://context7.com/mode-network/synth-subnet/llms.txt Defines the Pydantic model for simulation requests, specifying asset, start time, time increment, duration, and number of simulations. This model ensures structured input from validators to miners. ```python from datetime import datetime from pydantic import BaseModel, Field class SimulationInput(BaseModel): asset: str = Field(default="BTC", description="The asset to simulate.") start_time: str = Field( default=datetime.now().isoformat(), description="The start time of the simulation.", ) time_increment: int = Field( default=300, description="Time increment in seconds." ) time_length: int = Field( default=86400, description="Total time length in seconds." ) num_simulations: int = Field( default=1, description="Number of simulation runs." ) # Example usage for 24-hour BTC prediction simulation_params = SimulationInput( asset="BTC", start_time="2025-02-10T14:59:00+00:00", time_increment=300, # 5 minutes time_length=86400, # 24 hours num_simulations=1000 # 1000 price paths ) # Expected time points = (time_length / time_increment) + 1 = 289 points per path ``` -------------------------------- ### Manage Subnet Processes and Wallets via CLI Source: https://context7.com/mode-network/synth-subnet/llms.txt Shell commands for managing PM2 processes, registering Bittensor wallets, and running database migrations. ```bash pm2 start miner.config.js pm2 logs miner --lines 100 pm2 stop miner btcli wallet create --wallet.name miner --wallet.hotkey default btcli subnet register --wallet.name miner --wallet.hotkey default --netuid 50 alembic upgrade head ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Changes the current working directory to the root of the cloned synth-subnet project. Subsequent commands should be run from this directory. ```shell cd ./synth-subnet ``` -------------------------------- ### Configure Miner Neuron Parameters Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Demonstrates how to configure miner arguments using a PM2 configuration file or command-line overrides. This applies to settings like vpermit TAO limits, wallet credentials, and W&B integration. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--neuron.vpermit_tao_limit 1000", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --neuron.vpermit_tao_limit 1000 ``` -------------------------------- ### GET /validation/miner Source: https://context7.com/mode-network/synth-subnet/llms.txt Retrieves the validation status and performance metrics for a specific miner identified by its UID. ```APIDOC ## GET /validation/miner ### Description Checks the validation status and response time for a specific miner UID on the Synth network. ### Method GET ### Endpoint https://api.synthdata.co/validation/miner ### Parameters #### Query Parameters - **uid** (integer) - Required - The unique identifier of the miner to check. ### Request Example curl "https://api.synthdata.co/validation/miner?uid=123" ### Response #### Success Response (200) - **validated** (boolean) - Indicates if the miner's last submission was successfully validated. - **response_time** (string) - The latency of the miner's response in seconds. #### Response Example { "validated": true, "response_time": "2.45" } ``` -------------------------------- ### Price Simulation Dependencies (Python) Source: https://context7.com/mode-network/synth-subnet/llms.txt Lists the Python libraries required for fetching live asset prices and performing Monte Carlo simulations. Includes numpy for numerical operations and requests for API calls, with tenacity for retries. ```python import numpy as np import requests from tenacity import retry, stop_after_attempt, wait_random_exponential ``` -------------------------------- ### Configure Validator Timeout Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the maximum timeout in seconds for a validator neuron response. This parameter can be configured in the PM2 application file or directly when starting the process. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--neuron.timeout 120", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --neuron.timeout 120 ``` -------------------------------- ### Define Prediction Competition Parameters (Python) Source: https://context7.com/mode-network/synth-subnet/llms.txt Defines the `PromptConfig` dataclass for configuring prediction competitions, supporting both low-frequency (24-hour) and high-frequency (1-hour) prediction prompts. It specifies parameters like asset lists, time horizons, scoring intervals, and smoothing coefficients. ```python from dataclasses import dataclass @dataclass class PromptConfig: asset_list: list[str] label: str time_length: int # Total prediction horizon in seconds time_increment: int # Time step between predictions initial_delay: int # Delay before starting cycle total_cycle_minutes: int # Time between prompts timeout_extra_seconds: int # Extra time allowed for responses scoring_intervals: dict[str, int] window_days: int # Rolling window for score averaging softmax_beta: float # Softmax temperature (negative for lower=better) smoothed_score_coefficient: float # Weight for this prompt type num_simulations: int = 1000 data_retention_days: int = 30 # 24-hour prediction configuration (50% of emissions) LOW_FREQUENCY = PromptConfig( asset_list=["BTC", "ETH", "XAU", "SOL", "SPYX", "NVDAX", "TSLAX", "AAPLX", "GOOGLX"], label="low", time_length=86400, # 24 hours time_increment=300, # 5 minutes initial_delay=60, total_cycle_minutes=60, timeout_extra_seconds=60, scoring_intervals={ "5min": 300, "30min": 1800, "3hour": 10800, "24hour_abs": 86400, }, window_days=10, softmax_beta=-0.1, smoothed_score_coefficient=0.5, ) # 1-hour HFT prediction configuration (50% of emissions) HIGH_FREQUENCY = PromptConfig( asset_list=["BTC", "ETH", "XAU", "SOL"], label="high", time_length=3600, # 1 hour time_increment=60, # 1 minute initial_delay=0, total_cycle_minutes=12, timeout_extra_seconds=60, scoring_intervals={ "1min": 60, "5min": 300, "15min": 900, "30min": 1800, "60min_abs": 3600, }, window_days=3, softmax_beta=-0.2, smoothed_score_coefficient=0.5, ) ``` -------------------------------- ### Create Bittensor Cold/Hot Wallets Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Creates a new wallet with a specified name and hotkey. This is a fundamental step before interacting with the Bittensor network, such as registering or staking. ```shell btcli wallet create \ --wallet.name validator \ --wallet.hotkey default ``` -------------------------------- ### Define Prediction Response Format Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Specifies the JSON structure for submitting predictions, consisting of a start timestamp, time interval, and multiple arrays representing simulation price paths. ```json [ 1760084861, 300, [104856.23, 104972.01, 105354.9, ...], [104856.23, 104724.54, 104886, ...], [104856.23, 104900.12, 104950.45, ...] ] ``` -------------------------------- ### Configure PM2 for Miner and Validator Processes Source: https://context7.com/mode-network/synth-subnet/llms.txt Configuration files for managing Python neurons using PM2. Includes settings for mainnet and testnet environments. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--netuid 50 --wallet.name miner --wallet.hotkey default --axon.port 8091 --logging.debug", env: { PYTHONPATH: "." }, }, ], }; ``` ```javascript module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--netuid 50 --wallet.name validator --wallet.hotkey default --axon.port 8091 --sma.low.days 10 --sma.high.days 3 --softmax.low.beta -0.1 --softmax.high.beta -0.2", env: { PYTHONPATH: "." }, }, ], }; ``` -------------------------------- ### Clone Synth Subnet Repository Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Clones the official synth-subnet repository from GitHub to your local machine. This is the first step in setting up the validator. ```shell git clone https://github.com/mode-network/synth-subnet.git ``` -------------------------------- ### Configure Validator Axon Port Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the external port for the Axon component, which is used for inter-neuron communication. This can be configured directly in the PM2 start command or within the validator configuration file. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--axon.port 8091", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --axon.port 8091 ``` ```shell pm2 start validator.test.config.js -- --axon.port 8091 ``` -------------------------------- ### Simulate Asset Price Paths Source: https://context7.com/mode-network/synth-subnet/llms.txt Generates multiple price path simulations using geometric Brownian motion. It calculates cumulative returns based on volatility (sigma) and time increments. ```python def simulate_single_price_path(current_price, time_increment, time_length, sigma) -> np.ndarray: one_hour = 3600 dt = time_increment / one_hour num_steps = int(time_length / time_increment) std_dev = sigma * np.sqrt(dt) price_change_pcts = np.random.normal(0, std_dev, size=num_steps) cumulative_returns = np.cumprod(1 + price_change_pcts) cumulative_returns = np.insert(cumulative_returns, 0, 1.0) return current_price * cumulative_returns def simulate_crypto_price_paths(current_price, time_increment, time_length, num_simulations, sigma) -> np.ndarray: price_paths = [] for _ in range(num_simulations): path = simulate_single_price_path(current_price, time_increment, time_length, sigma) price_paths.append(path) return np.array(price_paths) ``` -------------------------------- ### Create Python Virtual Environment Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Creates a new Python virtual environment named 'bt_venv' using Python 3.11. This environment will host the project's Python dependencies. ```shell python3.11 -m venv bt_venv ``` -------------------------------- ### Configure Number of Processes for Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Specifies the number of processes to run for the validator dendrite. This can be set using a PM2 configuration file or as a command-line argument. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--neuron.nprocs 2", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --neuron.nprocs 2 ``` -------------------------------- ### Generate Miner Price Simulations Source: https://context7.com/mode-network/synth-subnet/llms.txt The primary entry point for miners to generate and format price predictions for validator submission. It integrates price fetching, volatility mapping, and simulation formatting. ```python def generate_simulations(asset="BTC", start_time="", time_increment=300, time_length=86400, num_simulations=1): if start_time == "": raise ValueError("Start time must be provided.") current_price = get_asset_price(asset) if current_price is None: raise ValueError(f"Failed to fetch current price for asset: {asset}") sigma = SIGMA_MAP.get(asset, 0.005) simulations = simulate_crypto_price_paths( current_price=current_price, time_increment=time_increment, time_length=time_length, num_simulations=num_simulations, sigma=sigma, ) predictions = convert_prices_to_time_format( simulations.tolist(), start_time, time_increment ) return predictions ``` -------------------------------- ### Configure Sample Size for Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Defines the number of validators to query in a single step. This setting can be applied via a PM2 configuration file or as a direct command-line argument. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--neuron.sample_size 50", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --neuron.sample_size 50 ``` -------------------------------- ### Activate Python Virtual Environment Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Activates the 'bt_venv' Python virtual environment. Once activated, the command line prompt will be prefixed with '(bt_venv)', indicating that the environment is active and Python commands will use its interpreter and packages. ```shell source bt_venv/bin/activate ``` -------------------------------- ### Configure Bittensor Neuron Device Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Specifies the hardware device (e.g., 'cuda') for running the neuron. This setting is configurable through PM2 or directly via the command line. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--neuron.device cuda", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --neuron.device cuda ``` -------------------------------- ### Configure Miner Blacklist Settings Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Manages security settings for incoming requests, including allowing non-registered entities, forcing validator permits, and setting minimum stake requirements. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--blacklist.allow_non_registered true --blacklist.force_validator_permit true --blacklist.validator_min_stake 1000", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --blacklist.allow_non_registered true --blacklist.force_validator_permit true --blacklist.validator_min_stake 1000 ``` -------------------------------- ### Bittensor Simulation Protocol (Python) Source: https://context7.com/mode-network/synth-subnet/llms.txt Implements the Bittensor Synapse protocol for communication between validators and miners. It defines the structure for simulation requests (SimulationInput) and price path predictions (simulation_output). ```python import bittensor as bt from synth.simulation_input import SimulationInput class Simulation(bt.Synapse): """ Protocol for price simulation requests and responses. """ # Input from validator simulation_input: SimulationInput # Output from miner - tuple format: (start_timestamp, time_increment, [path1], [path2], ...) simulation_output: tuple[int | list[int | float], ...] | None = None def deserialize(self): return self.simulation_output # Example response format from miner: # ( # 1760084861, # Unix timestamp of start time # 300, # Time increment in seconds # [104856.23, 104972.01, 105354.9, ...], # Path 1 (289 prices) # [104856.23, 104724.54, 104886.0, ...], # Path 2 (289 prices) # # ... 998 more paths for 1000 total simulations # ) ``` -------------------------------- ### Test Miner Model Locally Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_tutorial.md Executes the miner script locally to verify that the model generates the expected output format before deploying to the network. ```shell python synth/miner/run.py ``` -------------------------------- ### Configure Wallet Hotkey Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Specifies the hotkey for the wallet. This can be set within the PM2 application configuration or directly when executing the command. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--wallet.hotkey default", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --wallet.hotkey default ``` -------------------------------- ### Configure GCP Log ID Prefix with PM2 Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Configures the prefix for Google Cloud Platform log IDs for the validator. This helps in organizing and identifying logs originating from the validator. The prefix can be set in the PM2 configuration or via the command line. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--gcp.log_id_prefix my_validator_name", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --gcp.log_id_prefix my_validator_name ``` ```shell pm2 start validator.test.config.js -- --gcp.log_id_prefix my_validator_name ``` -------------------------------- ### Manage Miner Process Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Common PM2 commands for controlling the miner process and monitoring its output logs. ```shell pm2 stop miner pm2 logs miner --lines 100 ``` -------------------------------- ### Register Bittensor Wallet on Subnet Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Registers the created wallet on a specific Bittensor subnet (identified by netuid). This action acquires a slot on the network, allowing participation as a validator or miner. Includes options for both mainnet and testnet. ```shell btcli subnet register \ --wallet.name validator \ --wallet.hotkey default \ --netuid 50 ``` ```shell btcli subnet register \ --wallet.name validator \ --wallet.hotkey default \ --network test \ --netuid 247 ``` -------------------------------- ### Enable Info Level Logging in Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Turns on informational level logging for bittensor. This setting helps in monitoring the general operational status of the network. Configuration can be done via PM2 or command line. ```javascript module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--logging.info", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --logging.info ``` -------------------------------- ### Interactive Rebase for Squashing Commits (Git) Source: https://github.com/mode-network/synth-subnet/blob/main/contrib/CONTRIBUTING.md This Git command initiates an interactive rebase session, allowing you to modify a sequence of commits. It's commonly used to squash multiple small commits into a single, coherent commit before submitting a pull request, improving the commit history's readability. ```bash git checkout your_branch_name git rebase -i HEAD~n # n is normally the number of commits in the pull request. # Set commits (except the one in the first line) from 'pick' to 'squash', save and quit. # On the next screen, edit/refine commit messages. # Save and quit. git push -f # (force push to GitHub) ``` -------------------------------- ### SimulationInput Model Source: https://context7.com/mode-network/synth-subnet/llms.txt Defines the parameters required for validators to request price simulations from miners. ```APIDOC ## POST /simulation/input ### Description Defines the configuration for a price path simulation request, including the target asset and time parameters. ### Method POST ### Endpoint /simulation/input ### Request Body - **asset** (string) - Required - The asset to simulate (e.g., BTC, ETH, SOL, SPYX). - **start_time** (string) - Required - ISO 8601 formatted start time. - **time_increment** (integer) - Required - Time interval between price points in seconds. - **time_length** (integer) - Required - Total duration of the simulation in seconds. - **num_simulations** (integer) - Required - Number of Monte Carlo paths to generate. ### Request Example { "asset": "BTC", "start_time": "2025-02-10T14:59:00+00:00", "time_increment": 300, "time_length": 86400, "num_simulations": 1000 } ``` -------------------------------- ### Enable Miner Debug Logging Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Enables verbose debugging information for the Bittensor framework to assist in troubleshooting miner operations. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--logging.debug", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --logging.debug ``` -------------------------------- ### Configure Validator SMA Low Days Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the window in days for the simple moving average (SMA) of validator scores for the 24-hour prompt. This parameter influences how recent performance is weighted. Configurable via command line or config file. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--sma.low.days 10", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --sma.low.days 10 ``` -------------------------------- ### Configure Validator Wallet Name with PM2 Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the wallet name for the validator process using PM2 configuration. This ensures the validator uses the specified wallet for its operations. It can be configured directly in the pm2 config file or passed as a command-line argument. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--wallet.name validator", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --wallet.name validator ``` -------------------------------- ### Check Open Ports Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_tutorial.md Uses nmap to scan the local machine for open ports to ensure the required network configuration is active. ```shell nmap localhost ``` -------------------------------- ### Enable Trace Level Logging in Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Activates trace level logging for bittensor, providing the most granular details for debugging. This is useful for in-depth analysis of network behavior. Configuration is supported in PM2 or via command line. ```javascript module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--logging.trace", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --logging.trace ``` -------------------------------- ### Configure Bittensor Network UID Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md Sets the network unique identifier (netuid) for the subnet. This is crucial for connecting to the correct network. Configuration can be done in PM2 or on the command line. ```javascript module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--netuid 247", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start miner.config.js -- --netuid 247 ``` -------------------------------- ### Configure PYTHONPATH in miner.config.js Source: https://github.com/mode-network/synth-subnet/blob/main/docs/miner_reference.md This JavaScript configuration file demonstrates how to set the PYTHONPATH environment variable within the pm2 process manager configuration. This is crucial for Python to locate local modules, especially when running scripts like 'neurons/miner.py'. Ensure this variable points to the project root. ```javascript // miner.config.js module.exports = { apps: [ { name: "miner", interpreter: "python3", script: "./neurons/miner.py", args: "--netuid 247 --logging.debug --logging.trace --subtensor.network test --wallet.name miner --wallet.hotkey default --axon.port 8091", env: { PYTHONPATH: ".", }, }, ], }; ``` -------------------------------- ### Configure TAO Permit Limit for Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the maximum number of TAO allowed for the validator to process responses. Configuration is possible via a PM2 config file or directly on the command line. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--neuron.vpermit_tao_limit 1000", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --neuron.vpermit_tao_limit 1000 ``` -------------------------------- ### Fetch Asset Price from Pyth Oracle Source: https://context7.com/mode-network/synth-subnet/llms.txt Retrieves the latest price for a specified asset using the Pyth Hermes API. It includes a retry mechanism for robustness and handles price exponent scaling. ```python TOKEN_MAP = { "BTC": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", "ETH": "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace", "XAU": "765d2ba906dbc32ca17cc11f5310a89e9ee1f6420508c63861f2f8ba4ee34bb2", "SOL": "ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d", } @retry(stop=stop_after_attempt(5), wait=wait_random_exponential(multiplier=2), reraise=True) def get_asset_price(asset="BTC") -> float | None: pyth_base_url = "https://hermes.pyth.network/v2/updates/price/latest" pyth_params = {"ids[]": [TOKEN_MAP[asset]]} response = requests.get(pyth_base_url, params=pyth_params) if response.status_code != 200: return None data = response.json() parsed_data = data.get("parsed", []) asset_data = parsed_data[0] price = int(asset_data["price"]["price"]) expo = int(asset_data["price"]["expo"]) return price * (10 ** expo) ``` -------------------------------- ### Configure Validator SMA High Days Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the window in days for the simple moving average (SMA) of validator scores for the 1-hour prompt. This parameter affects the weighting of short-term performance metrics. Configurable via command line or config file. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--sma.high.days 3", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --sma.high.days 3 ``` -------------------------------- ### Configure Events Retention Size for Validator Source: https://github.com/mode-network/synth-subnet/blob/main/docs/validator_guide.md Sets the size for retaining events for the validator. The default is 2GB. Configuration can be done using a PM2 config file or directly via the command line. ```javascript // validator.config.js module.exports = { apps: [ { name: "validator", interpreter: "python3", script: "./neurons/validator.py", args: "--neuron.events_retention_size 2147483648", env: { PYTHONPATH: ".", }, }, ], }; ``` ```shell pm2 start validator.config.js -- --neuron.events_retention_size 2147483648 ```