# 0xmoei/drosera-network architecture

> Architecture diagram of the GitHub repository 0xmoei/drosera-network, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xmoei/drosera-network
- Repository: https://github.com/0xmoei/drosera-network

## Overview

##### Main Components
- Developer Environment: Represents the local development setup where a user installs system dependencies (e.g., Docker, build tools) and CLI tools (Drosera CLI, Foundry CLI, Bun).
- Trap Deployment Module: This includes the smart contract (“Trap”) which is initialized, compiled (via Foundry and Bun), and deployed to the test network using the Drosera CLI.
- Operator Node: The operator is set up through the drosera-operator, configured via systemd, and optionally deployed using Docker. This component registers with the testnet using provided EVM credentials.
- Ethereum Testnet (Holesky ETH): Acts as the underlying blockchain network where the trap contract is deployed and operator transactions (including registration and block production) take place.
- Drosera Dashboard: A web-based monitoring interface where users can view their deployed traps, connect their wallet, send boosts (like Bloom Boost), and observe node liveness.
- Configuration Management: Includes the trap configuration file (drosera.toml) and environment variable setup (like the private key and operator address) that control behavior for both trap and operator deployments.

##### Relationships and Interactions
- The Developer Environment uses Drosera CLI to interact with the Ethereum testnet by deploying and updating the trap contract.
- The trap contract establishes an on-chain “trap” that users can manage via the Drosera Dashboard. It communicates with the testnet and, upon deployment, becomes visible and manageable via the Dashboard.
- The Operator Node (installed via drosera-operator) connects to the testnet RTC (p2p port 31313) and a server component on port 31314. It consumes blockchain data, registers using the private key, and signals its health back to the Drosera Dashboard.
- Configuration files (e.g., drosera.toml) bridge the developer’s intended setup with the runtime behavior of the trap and operator.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Different modules handle different responsibilities (deployment, monitoring, operator functions).
- Environment Provisioning: The step-by-step CLI and Docker instructions indicate a strong emphasis on environment consistency and reliability.
- Automation & Service Management: The operator node is set up as a systemd service ensuring high availability and using typical Linux service management practices.

##### Relevant Technologies and Frameworks
- CLI tools: Drosera CLI, Foundry CLI, Bun for smart contract development, and drosera-operator for node management.
- Blockchain/Ethereum: Deployment of smart contracts and EVM interactions via provided RPC endpoints.
- Deployment Tools: Docker for containerization (optional), systemd for operator node management.
- Network & Security: UFW and firewall rules for controlling access to exposed ports.

##### Instructing the Principal Software Engineer
- Developer actions (installation, configuration, deployment) directing the setup of the Trap and Operator.
- The Trap’s on-chain interactions with the Ethereum testnet.
- Feedback loops from the testnet to the Dashboard.
- Annotations or labels that reference key ports (e.g., 31313 for p2p, 31314 for server) and the network endpoints (e.g., Ethereum RPC URLs).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Setup and Environment
    subgraph "Setup and Environment"
        dev["Developer Environment (CLI Tools: Drosera, Foundry, Bun)"]:::cli
        config["Configuration Management (drosera.toml & Environment Variables)"]:::config
    end

    %% Deployment Modules
    subgraph "Deployment Modules"
        trap["Trap Deployment Module (Smart Contract 'Trap')"]:::blockchain
        operator["Operator Node (drosera-operator + systemd Service)"]:::operator
    end

    %% Network and Monitoring
    subgraph "Network and Monitoring"
        testnet["Ethereum Testnet (Holesky ETH)"]:::blockchain
        dashboard["Drosera Dashboard (Web UI Monitoring)"]:::dashboard
    end

    %% Relationships
    dev -->|"deploys/setup"| trap
    config -->|"configures"| trap
    dev -->|"configures"| config
    trap -->|"deployedTo"| testnet
    operator -->|"registers/connects"| testnet
    operator -->|"statusUpdates"| dashboard
    testnet -->|"feedback"| dashboard

    %% Click Events
    click dev "https://github.com/0xmoei/drosera-network/blob/main/README.md"
    click config "https://github.com/0xmoei/drosera-network/blob/main/README.md"
    click trap "https://github.com/0xmoei/drosera-network/blob/main/README.md"
    click operator "https://github.com/0xmoei/drosera-network/blob/main/README.md"
    click testnet "https://github.com/0xmoei/drosera-network/blob/main/README.md"
    click dashboard "https://github.com/0xmoei/drosera-network/blob/main/README.md"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef blockchain fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef operator fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef dashboard fill:#DA70D6,stroke:#000,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
