How condenses/subnet-miner works
Main Components
• Condense Miner Core – This is the main logic found in the “condense_miner” directory with files such as main.py, config.py, protocol.py, and redis_manager.py. It handles setup, configuration, protocol logic, and manages connections to Redis.
• Redis Datastore – The project uses Redis (as indicated by the redis_manager.py and install_redis.sh script) to handle caching or data storage.
• Sidecar Bittensor Service – As described in the README’s “Sidecar Bittensor” section, this process, started via pm2, runs a uvicorn server that provides metagraph and chain functionality. Even though its code isn’t in this repository, it is an essential integration point.
• Environment and Deployment Scripts – The “scripts” directory (containing install_redis.sh and update_env.py) includes deployment and environment-setup utilities to manage environment variables critical for configuration.
• Containerization (via Dockerfile) – The Dockerfile indicates that there is a containerized deployment option.
Relationships and Interactions
• The Condense Miner (main.py) is the central process. It retrieves its configuration and possibly connection parameters from config.py and update_env.py.
• The Condense Miner process interfaces with the Sidecar Bittensor service through specified API calls, as indicated by the requirement to set “SIDECAR_BITTENSOR__BASE_URL” via environment variables.
• Deployment and startup are managed by external orchestration processes (pm2 and Docker) as described in the README.
Architectural Patterns and Design Principles
• Modular Design – The clear division into a core miner module, configuration, and Redis integration supports a separation of concerns.
• Microservices/Process-Oriented – The use of separate processes (Condense Miner and Sidecar) and containerization (Dockerfile) suggests that the project is built using a microservices-like approach. Each component is confined to its responsibility.
• Environment-Driven Configuration – The use of update-env scripts and environment variables underscores the principle of externalizing configuration for flexibility.
Relevant Technologies and Frameworks
• Python – The overall project is Python-based. The presence of a Dockerfile suggests containerized deployments.
• Redis – For caching/data storage.
• pm2 and uvicorn – pm2 is used for process management while uvicorn is used for serving the sidecar’s API.
• Version/Dependency Management – The pyproject.toml file indicates use of modern Python packaging approaches.