# redteamsubnet/redteam architecture

> Architecture diagram of the GitHub repository redteamsubnet/redteam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redteamsubnet/redteam
- Repository: https://github.com/redteamsubnet/redteam

## Overview

RedTeam is a Bittensor cybersecurity-challenge subnet: miners submit Docker-based solutions, and validators run challenge-specific evaluation, check originality, maintain scores, and persist validator and submission state. The graph captures the documented submission-to-evaluation-to-incentive workflow and sampled Docker, scoring, and storage responsibilities. Validator lifecycle wiring and some README-described scoring details are not present in the sampled excerpts, so uncertain calls between those components are omitted.

Main entry points: [`src/redteam_core/challenge_pool/controller.py`](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/controller.py) (Challenge controller), [`src/redteam_core/validator/miner_manager.py`](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/miner_manager.py) (Miner scoring), [`src/redteam_core/config/main.py`](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/config/main.py) (Runtime configuration), [`src/redteam_core/protocol.py`](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/protocol.py) (Commit protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Miner Submission"]
  node_commit_protocol["Commit protocol<br/>[protocol.py]"]
end

subgraph group_evaluation["Challenge Evaluation"]
  node_active_challenges["Active challenge config"]
  node_challenge_manager["Challenge state"]
  node_controller["Challenge controller<br/>[controller.py]"]
  node_docker_utils["Docker runtime<br/>[docker_utils.py]"]
end

subgraph group_validator["Validator Scoring"]
  node_miner_manager["Miner scoring<br/>[miner_manager.py]"]
  node_storage_manager["State and commit storage<br/>[storage_manager.py]"]
  node_config["Runtime configuration<br/>[main.py]"]
  node_log_handler["Remote log forwarding<br/>[log_handler.py]"]
end

subgraph group_integrations["External Services"]
  node_docker_engine["Docker engine"]
  node_internal_services["Internal scoring services"]
  node_storage_api["Storage API"]
  node_bittensor_network["Bittensor network"]
end

node_miner(("Miner"))

node_miner -->|"submits commits"| node_commit_protocol
node_commit_protocol -->|"exchanges synapses"| node_bittensor_network
node_active_challenges -->|"resolves manager class"| node_challenge_manager
node_controller -->|"runs containers"| node_docker_utils
node_docker_utils -->|"controls runtime"| node_docker_engine
node_controller -->|"checks similarity"| node_internal_services
node_controller -->|"requests scoring"| node_internal_services
node_miner_manager -->|"aggregates challenge scores"| node_challenge_manager
node_miner_manager -->|"reads metagraph"| node_bittensor_network
node_storage_manager -->|"fetches and uploads state"| node_storage_api
node_log_handler -->|"uploads logs"| node_storage_api
node_config -->|"provides API settings"| node_storage_manager
node_config -->|"provides service settings"| node_controller

click node_commit_protocol "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/protocol.py"
click node_active_challenges "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/active_challenges_manager.py"
click node_challenge_manager "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/challenge_manager.py"
click node_controller "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/controller.py"
click node_docker_utils "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/docker_utils.py"
click node_miner_manager "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/miner_manager.py"
click node_storage_manager "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/storage_manager.py"
click node_config "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/config/main.py"
click node_log_handler "https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/log_handler.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_commit_protocol toneBlue
class node_active_challenges,node_challenge_manager,node_controller,node_docker_utils toneAmber
class node_miner_manager,node_storage_manager,node_config,node_log_handler toneMint
class node_docker_engine,node_internal_services,node_storage_api,node_bittensor_network toneRose
class node_miner toneIndigo
```

## Components

### Miner Submission

- [Commit protocol](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/protocol.py): `src/redteam_core/protocol.py`

### Challenge Evaluation

- [Active challenge config](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/active_challenges_manager.py): `src/redteam_core/challenge_pool/active_challenges_manager.py`
- [Challenge state](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/challenge_manager.py): `src/redteam_core/validator/challenge_manager.py`
- [Challenge controller](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/controller.py): `src/redteam_core/challenge_pool/controller.py`
- [Docker runtime](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/challenge_pool/docker_utils.py): `src/redteam_core/challenge_pool/docker_utils.py`

### Validator Scoring

- [Miner scoring](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/miner_manager.py): `src/redteam_core/validator/miner_manager.py`
- [State and commit storage](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/storage_manager.py): `src/redteam_core/validator/storage_manager.py`
- [Runtime configuration](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/config/main.py): `src/redteam_core/config/main.py`
- [Remote log forwarding](https://github.com/redteamsubnet/redteam/blob/main/src/redteam_core/validator/log_handler.py): `src/redteam_core/validator/log_handler.py`

### External Services

- **Docker engine**
- **Internal scoring services**
- **Storage API**
- **Bittensor network**

### Other components

- **Miner**

## Connections

- Miner → Commit protocol: submits commits
- Commit protocol → Bittensor network: exchanges synapses
- Active challenge config → Challenge state: resolves manager class
- Challenge controller → Docker runtime: runs containers
- Docker runtime → Docker engine: controls runtime
- Challenge controller → Internal scoring services: checks similarity
- Challenge controller → Internal scoring services: requests scoring
- Miner scoring → Challenge state: aggregates challenge scores
- Miner scoring → Bittensor network: reads metagraph
- State and commit storage → Storage API: fetches and uploads state
- Remote log forwarding → Storage API: uploads logs
- Runtime configuration → State and commit storage: provides API settings
- Runtime configuration → Challenge controller: provides service settings
