# yetanotherco/aligned_layer architecture

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

- Interactive diagram: https://gitdiagram.com/yetanotherco/aligned_layer
- Repository: https://github.com/yetanotherco/aligned_layer

## Overview

##### Data Flow and Interactions

a) User Flow:
- Proof flow through batcher
- Payment processing path

b) Operator Flow:
- Operator registration process
- Proof verification path
- Connection to EigenLayer staking

c) Storage & Communication:
- S3 Storage for proofs
- Database connections (PostgreSQL)
- Message queues/event systems

##### Key Integration Points

a) External Services:
- EigenLayer connection
- Ethereum network interaction
- AWS S3 storage

b) Internal Communications:
- REST APIs between components
- WebSocket connections
- Event subscriptions

##### Monitoring & Management

- Telemetry flow
- Prometheus metrics
- Grafana dashboards
- Alert system connections

##### Specific Implementation Details

- Core business logic
- Infrastructure components
- Security layers
- Scaling components

- Contract interactions
- Service communications
- Data flow

##### Security Measures
- BLS signature verification
- Smart contract security boundaries
- Access control points

##### Scaling Points
- Batch processing
- Proof aggregation
- Database partitioning

##### Environment Boundaries
- Development
- Staging
- Production

- Proof submission and verification
- Operator registration and management
- Payment processing
- Monitoring and alerting

Remember to emphasize the modular nature of the proving systems and their integration with EigenLayer, as these appear to be core architectural features of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Users
        U[User]
    end

    subgraph "Core Services"
        BS["Batcher Service"]:::service
        OS["Operator Service"]:::service
        AS["Aggregator Service"]:::service
        ES["Explorer Service"]:::service
        TS["Telemetry API"]:::service
    end

    subgraph "Blockchain Layer"
        ALSM["AlignedLayerServiceManager"]:::contract
        BPS["BatcherPaymentService"]:::contract
        EL["EigenLayer Contracts"]:::contract
    end

    subgraph "Proving Systems"
        GN["GNARK (GROTH16 & PLONK)"]:::prover
        RZ["RiscZero"]:::prover
        SP["SP1"]:::prover
    end

    subgraph "Storage & Infrastructure"
        S3["AWS S3"]:::storage
        DB[(PostgreSQL)]:::db
        MQ{"Message Queue"}:::queue
    end

    subgraph "Monitoring"
        PROM["Prometheus"]:::monitor
        GRAF["Grafana"]:::monitor
        ALERT["Alert System"]:::monitor
    end

    U --> BS
    BS --> |Batch Processing| AS
    BS --> |Store Proofs| S3
    BS --> |Payment| BPS
    OS --> |Verify Proofs| AS
    OS --> |Register| ALSM
    OS --> |Stake| EL
    AS --> |Store Results| DB
    ES --> |Query| DB
    ES --> |Contract Data| ALSM
    TS --> |Collect Metrics| PROM
    PROM --> GRAF
    PROM --> ALERT

    GN --> OS
    RZ --> OS
    SP --> OS

    %% Component Mappings
    click BS "https://github.com/yetanotherco/aligned_layer/tree/testnet/batcher/aligned-batcher/"
    click OS "https://github.com/yetanotherco/aligned_layer/tree/testnet/operator/"
    click AS "https://github.com/yetanotherco/aligned_layer/tree/testnet/aggregator/"
    click ES "https://github.com/yetanotherco/aligned_layer/tree/testnet/explorer/"
    click TS "https://github.com/yetanotherco/aligned_layer/tree/testnet/telemetry_api/"
    click ALSM "https://github.com/yetanotherco/aligned_layer/tree/testnet/contracts/bindings/AlignedLayerServiceManager/"
    click BPS "https://github.com/yetanotherco/aligned_layer/blob/testnet/batcher/aligned-sdk/abi/BatcherPaymentService.json"
    click EL "https://github.com/yetanotherco/aligned_layer/tree/testnet/contracts/lib/eigenlayer-middleware/"
    click GN "https://github.com/yetanotherco/aligned_layer/tree/testnet/batcher/aligned-batcher/gnark/"
    click RZ "https://github.com/yetanotherco/aligned_layer/tree/testnet/operator/risc_zero/"
    click SP "https://github.com/yetanotherco/aligned_layer/tree/testnet/operator/sp1/"
    click GRAF "https://github.com/yetanotherco/aligned_layer/tree/testnet/grafana/provisioning/dashboards/aligned/"
    click ALERT "https://github.com/yetanotherco/aligned_layer/tree/testnet/alerts/"

    classDef service fill:#f9f,stroke:#333,stroke-width:2px
    classDef contract fill:#f96,stroke:#333,stroke-width:2px
    classDef prover fill:#gray,stroke:#333,stroke-width:2px
    classDef storage fill:#9cf,stroke:#333,stroke-width:2px
    classDef db fill:#fcf,stroke:#333,stroke-width:2px
    classDef queue fill:#ff9,stroke:#333,stroke-width:2px
    classDef monitor fill:#9f9,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Service"]:::service
        L2["Contract"]:::contract
        L3["Prover"]:::prover
        L4["Storage"]:::storage
        L5["Database"]:::db
        L6["Queue"]:::queue
        L7["Monitor"]:::monitor
    end
```
