# marlinprotocol/oyster-monorepo architecture

> Architecture diagram of the GitHub repository marlinprotocol/oyster-monorepo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marlinprotocol/oyster-monorepo
- Repository: https://github.com/marlinprotocol/oyster-monorepo

## Overview

##### Main Component Groups

a) Attestation Layer
- Attestation servers (standard, custom, mock) at the top
- To verifier components (standard, enclave, RISC-zero)

b) Serverless Infrastructure
- Gateway and executor components centrally
- HTTP-over-vsock communication paths
- Transaction manager component

c) Networking Layer
- TCP and Raw proxies
- Connection to initialization services
- Performance monitoring (iperf3)

d) Smart Contract Layer
- Contracts at the bottom
- Indexer component
- Interaction with gateway

##### Component Relationships

**[Attestation Servers] → [Verifiers]**
- ↓
**[Gateway Enclave] ←→ [Executor]**
- ↕
**[Smart Contracts] ←→ [Indexer]**

##### Specific Implementation Details

Technical elements:
- VSOCK communication channels between components
- Initialization flow with init-server
- Control plane management interface
- SDK integration points (Go/Rust)

##### Component Grouping

Create distinct zones for:
- Infrastructure components (kernels, networking)
- Runtime components (executor, gateway)
- Management components (control-plane, quota-monitor)
- Development tools (SDKs, initialization)

##### Critical Details

Aspects:
- Security boundaries between enclave and non-enclave components
- Integration points with AWS infrastructure
- Transaction flow paths
- Attestation verification chains

##### Implementation Notes

Annotations for:
- Supported kernel variants
- SDK integration points
- Contract interaction flows
- Initialization sequences

Remember to indicate the scalability points and potential bottlenecks, as this will be valuable for understanding system limitations and expansion capabilities.

This system design should clearly show how Oyster combines secure enclaves, blockchain technology, and serverless computing into a cohesive platform while maintaining security and verifiability through its attestation system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef enclave fill:#f9f,stroke:#333,stroke-width:2px
    classDef service fill:#afd,stroke:#333
    classDef mock fill:#fdd,stroke:#333
    classDef contract fill:#ddf,stroke:#333
    classDef network fill:#dfd,stroke:#333
    classDef sdk fill:#ffd,stroke:#333
    classDef management fill:#dff,stroke:#333

    %% Attestation Layer
    subgraph Attestation
        AS["Standard Server"]
        AC["Custom Server"]
        AM["Mock Server"]
        VS["Standard Verifier"]
        VE["Enclave Verifier"]
        VR["RISC-Zero Verifier"]
    end

    %% Serverless Layer
    subgraph Serverless
        GE["Gateway Enclave"]:::enclave
        EX["Executor"]
        TM["Transaction Manager"]
    end

    %% Networking Layer
    subgraph Network
        TP["TCP Proxy"]
        RP["Raw Proxy"]
        PE["Performance Testing"]
        HC["HTTP-VSOCK Client"]
        HS["HTTP-VSOCK Server"]
    end

    %% Smart Contract Layer
    subgraph Contracts
        SC["Smart Contracts"]
        IN["Indexer"]
    end

    %% Initialization Layer
    subgraph Init
        IS["Init Server"]
        KG["Key Generation"]
    end

    %% Management Layer
    subgraph Management
        CP["Control Plane"]
        QM["Quota Monitor"]
    end

    %% SDK Layer
    subgraph SDKs
        GO["Go SDK"]
        RS["Rust SDK"]
    end

    %% Relationships
    AS --> VS
    AC --> VE
    AM --> VR
    VS & VE & VR --> GE
    GE <--> EX
    GE <--> TM
    GE <--> SC
    SC <--> IN
    TP & RP --> GE
    HC <--> HS
    IS --> GE
    KG --> GE
    CP --> GE
    QM --> GE
    GO & RS --> GE

    %% Click Events
    click AS "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/server/"
    click AC "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/server-custom/"
    click AM "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/server-custom-mock/"
    click VS "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/verifier/"
    click VE "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/verifier-enclave/"
    click VR "https://github.com/marlinprotocol/oyster-monorepo/tree/master/attestation/verifier-risczero/"
    click GE "https://github.com/marlinprotocol/oyster-monorepo/tree/master/serverless/gateway-enclave/"
    click EX "https://github.com/marlinprotocol/oyster-monorepo/tree/master/serverless/executor/"
    click TM "https://github.com/marlinprotocol/oyster-monorepo/tree/master/serverless/transaction-manager/"
    click TP "https://github.com/marlinprotocol/oyster-monorepo/tree/master/networking/tcp-proxy/"
    click RP "https://github.com/marlinprotocol/oyster-monorepo/tree/master/networking/raw-proxy/"
    click PE "https://github.com/marlinprotocol/oyster-monorepo/tree/master/networking/iperf3-enclave/"
    click SC "https://github.com/marlinprotocol/oyster-monorepo/tree/master/contracts/contracts/"
    click IN "https://github.com/marlinprotocol/oyster-monorepo/tree/master/contracts/indexer/"
    click IS "https://github.com/marlinprotocol/oyster-monorepo/tree/master/initialization/init-server/"
    click KG "https://github.com/marlinprotocol/oyster-monorepo/tree/master/initialization/keygen/"
    click CP "https://github.com/marlinprotocol/oyster-monorepo/tree/master/operator/control-plane/"
    click QM "https://github.com/marlinprotocol/oyster-monorepo/tree/master/operator/quota-monitor-aws/"
    click GO "https://github.com/marlinprotocol/oyster-monorepo/tree/master/sdks/go/"
    click RS "https://github.com/marlinprotocol/oyster-monorepo/tree/master/sdks/rs/"
    click HC "https://github.com/marlinprotocol/oyster-monorepo/tree/master/serverless/http-on-vsock-client/"
    click HS "https://github.com/marlinprotocol/oyster-monorepo/tree/master/serverless/http-on-vsock-server/"

    %% Legend
    subgraph Legend
        L1["Enclave Component"]:::enclave
        L2["Service Component"]:::service
        L3["Mock Component"]:::mock
        L4["Contract Component"]:::contract
    end
```
