# layr-labs/eigenda architecture

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

- Interactive diagram: https://gitdiagram.com/layr-labs/eigenda
- Repository: https://github.com/layr-labs/eigenda

## Overview

##### Main Components
- Smart Contracts: Represented by the “contracts” directory. These are deployed on Ethereum and define the core on-chain operations and verifications.
- API Layer: Found under “api” (with its builder, clients, documentation, and GRPC support) which exposes public endpoints. This also communicates with client applications and partner integrations.
- Core Libraries & Services: The “core”, “common”, and “crypto” directories contain the business logic, cryptographic functions (FFT, KZG, RS encoding, etc.), state management, and protocol-specific utilities.
- Disperser Service: Under “disperser”, you have components related to blob dispersion, batching, encoding, and gRPC-based servers. This service is critical for the high-throughput and decentralized availability of data blobs.
- Node Components: The “node”, “lightnode”, and “operators” directories provide the code needed to run an operator node, which interacts with other services and participates in the network.
- Supporting Tools & Infrastructure: Directories like “inabox” (for local testing and deployment), “tools”, “encoding”, and “test” provide supplementary tooling, deployment scripts, and integration tests.

##### Relationships and Interactions
- API Layer – Clients interact with the public API endpoints to submit or retrieve data availability requests. The API communicates with underlying core services.
- Disperser Services – These interact with both the API and the node components; they batch, encode, and disseminate data blobs for availability.
- Node & Operator Components – Node software interacts with on-chain smart contracts (from the “contracts” module) to manage state, submit attestations, and monitor network events.
- Core and Encoding Libraries – They support the services by managing data transformations (e.g., FFTs, polynomial operations) and verifications before data is broadcast.
- External Dependencies – The architecture leverages Ethereum and EigenLayer, so include these external services as well as any cloud or container infrastructure (Dockerfiles, GitHub Actions workflows, etc.) that support deployment and CI/CD.

##### Architectural Patterns and Design Principles
- Modular & Microservices-like Architecture: Each major logical component (API, node, disperser, indexer) is organized as an individual module or service, allowing independent development and deployment.
- Clear Separation of Concerns: Frontend/API endpoints separate from underlying core logic and smart contracts.
- Blockchain Integration: Interaction with on-chain smart contracts, using GRPC and REST protocols, places this architecture within a hybrid on-chain/off-chain system.
- Use of Standard Protocols: The presence of protobufs (in “api/proto” and “docs/spec/src/protobufs”) and gRPC indicates a pattern built around well-defined data schemas for communication.

##### Relevant Technologies, Frameworks, and Libraries
- Go: Most of the code (services, nodes, encoding libraries) is written in Go.
- Docker and Dev Containers: Directories like “.devcontainer”, “Dockerfile”, “inabox/anvil/docker-compose.yaml” indicate containerized deployments.
- Ethereum and EigenLayer: The smart contracts are written for Ethereum, and integration with EigenLayer is core to the project.
- GRPC/Protobuf, REST APIs, and Test Infrastructure: Communication is organized around these industry-standard tools.
- Cryptographic & Encoding Libraries: From “encoding/fft”, “encoding/kzg”, “crypto/ecc”, etc., which are fundamental to the DA mechanism.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    Clients["Clients"]:::external
    Ethereum["Ethereum"]:::external
    EigenLayer["EigenLayer"]:::external

    %% On-chain Component
    SmartContracts["Smart Contracts"]:::blockchain

    %% Off-chain Components
    subgraph "API & Services"
        API["API Service"]:::api
        subgraph "Core Libraries & Services"
            Core["Core"]:::core
            Common["Common"]:::core
            Crypto["Crypto"]:::core
            Encoding["Encoding"]:::core
        end
        Disperser["Disperser Service"]:::disperser
        subgraph "Node Components"
            Node["Node"]:::node
            Lightnode["Lightnode"]:::node
            Operators["Operators"]:::node
        end
        subgraph "Indexing & Subgraphs"
            Indexer["Indexer"]:::indexing
            Subgraphs["Subgraphs"]:::indexing
        end
    end

    %% Supporting Tools & Infrastructure
    subgraph "Supporting Tools & Infrastructure"
        Inabox["Inabox"]:::infra
        Tools["Tools"]:::infra
    end

    %% Data Flows
    Clients -->|"submit_request"| API
    API -->|"invokes"| Core
    API -->|"calls"| Disperser
    Core -->|"processes_data"| Disperser
    Disperser -->|"communicates"| Node
    Node -->|"interacts_with"| SmartContracts
    Lightnode -->|"interacts_with"| SmartContracts
    Operators -->|"interacts_with"| SmartContracts
    SmartContracts -->|"emits_events"| Indexer
    SmartContracts -->|"emits_events"| Subgraphs
    Indexer -->|"feeds_data"| API
    Subgraphs -->|"feeds_data"| API

    %% External Integration
    API ---|"integrates"| Ethereum
    SmartContracts ---|"deployed_on"| Ethereum
    Ethereum ---|"governed_by"| EigenLayer

    %% Supporting Tools Relations
    Inabox ---|"deployment"| API
    Inabox ---|"deployment"| Node
    Tools ---|"CI/CD_integration"| API
    Tools ---|"CI/CD_integration"| Node

    %% Click Events for Component Mapping
    click SmartContracts "https://github.com/layr-labs/eigenda/tree/master/contracts/"
    click API "https://github.com/layr-labs/eigenda/tree/master/api/"
    click Core "https://github.com/layr-labs/eigenda/tree/master/core/"
    click Common "https://github.com/layr-labs/eigenda/tree/master/common/"
    click Crypto "https://github.com/layr-labs/eigenda/tree/master/crypto/"
    click Encoding "https://github.com/layr-labs/eigenda/tree/master/encoding/"
    click Disperser "https://github.com/layr-labs/eigenda/tree/master/disperser/"
    click Node "https://github.com/layr-labs/eigenda/tree/master/node/"
    click Lightnode "https://github.com/layr-labs/eigenda/tree/master/lightnode/"
    click Operators "https://github.com/layr-labs/eigenda/tree/master/operators/"
    click Indexer "https://github.com/layr-labs/eigenda/tree/master/indexer/"
    click Subgraphs "https://github.com/layr-labs/eigenda/tree/master/subgraphs/"
    click Inabox "https://github.com/layr-labs/eigenda/tree/master/inabox/"
    click Tools "https://github.com/layr-labs/eigenda/tree/master/tools/"

    %% Styles
    classDef external fill:#FFECB3,stroke:#FBC02D,stroke-width:2px;
    classDef blockchain fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef api fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef core fill:#E1BEE7,stroke:#6A1B9A,stroke-width:2px;
    classDef disperser fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
    classDef node fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef indexing fill:#D1C4E9,stroke:#5E35B1,stroke-width:2px;
    classDef infra fill:#CFD8DC,stroke:#455A64,stroke-width:2px;
```
