# omni-network/omni architecture

> Architecture diagram of the GitHub repository omni-network/omni, 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/omni-network/omni
- Repository: https://github.com/omni-network/omni

## Overview

##### Main Components

a) Core Protocol Layer:
- Halo Instance (Consensus Layer)
- Octane (EVM Engine)
- Cross-chain Messaging System
- Relayer Service

b) Smart Contract Layer:
- Core Protocol Contracts
- AVS (Eigen) Contracts
- Portal Contracts
- Bridge Contracts

c) Supporting Infrastructure:
- Monitoring System
- SDK/Client Layer
- Development Tools

##### Component Relationships

**┌─────────────────────────────────────────────────────────────┐**
- Client/SDK Layer                        │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Smart Contract Layer (Solidity)                     │
- ┌──────────┐  ┌──────────┐  ┌──────────┐   ┌──────────┐   │
- Core    │  │  Portal  │  │  Bridge  │   │   AVS    │   │
- Contracts │  │Contracts │  │Contracts │   │Contracts │   │
- ┘  └──────────┘  └──────────┘   └──────────┘   │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Core Protocol Layer                         │
- ┌──────────┐  ┌──────────┐  ┌──────────┐   ┌──────────┐   │
- Halo    │  │  Octane  │  │ XChain   │   │ Relayer  │   │
- Consensus │←→│   EVM    │←→│Messaging │←──│ Service  │   │
- ┘  └──────────┘  └──────────┘   └──────────┘   │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Infrastructure Layer                          │
- ┌──────────┐  ┌──────────┐  ┌──────────┐   ┌──────────┐   │
- Monitoring│  │  DevNet  │  │  Tests   │   │  Tools   │   │
- System   │  │          │  │          │   │          │   │
- ┘  └──────────┘  └──────────┘   └──────────┘   │
- ┘

##### Important Details

a) Core Protocol Components:
- Halo: Consensus mechanism and attestation system
- Octane: EVM compatibility layer
- XChain: Cross-chain messaging protocol
- Relayer: Message delivery service

b) Smart Contract Components:
- Core contracts for protocol governance
- Portal contracts for cross-chain interaction
- Bridge contracts for asset transfer
- AVS contracts for validation

c) Infrastructure Components:
- Monitoring and metrics system
- Development and testing tools
- Network configurations (mainnet, testnet, devnet)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client ["Client/SDK Layer"]
        SDK["SDK/Client Interface"]:::sdk
        Types["SDK Types"]:::sdk
        ChainUtils["Chain Utilities"]:::sdk
    end

    subgraph Contracts ["Smart Contract Layer"]
        CoreContracts["Core Protocol Contracts"]:::contract
        PortalContracts["Portal Contracts"]:::contract
        BridgeContracts["Bridge Contracts"]:::contract
        AVSContracts["AVS Contracts"]:::contract
    end

    subgraph Protocol ["Core Protocol Layer"]
        subgraph HaloSystem ["Halo System"]
            HaloCore["Core Implementation"]:::core
            ConsensusModules["Consensus Modules"]:::core
            ValidatorSync["Validator Sync"]:::core
        end

        subgraph OctaneSystem ["Octane System"]
            EVMEngine["EVM Engine"]:::core
            EngineKeeper["Engine Keeper"]:::core
        end

        subgraph XChainSystem ["Cross-Chain System"]
            XChainCore["Core Messaging"]:::core
            XChainProvider["Provider Implementation"]:::core
        end

        subgraph RelayerSystem ["Relayer System"]
            RelayerCore["Core Implementation"]:::core
            RelayerConfig["Configuration"]:::core
        end
    end

    subgraph Infrastructure ["Infrastructure Layer"]
        subgraph MonitoringSystem ["Monitoring"]
            CoreMonitor["Core Monitoring"]:::infra
            ValidatorMonitor["Validator Monitoring"]:::infra
            ContractMonitor["Contract Monitoring"]:::infra
        end

        subgraph DevTools ["Development Tools"]
            E2ETests["E2E Testing"]:::infra
            CLITools["CLI Tools"]:::infra
            DevScripts["Development Scripts"]:::infra
        end
    end

    %% Relationships
    SDK --> CoreContracts
    SDK --> PortalContracts
    CoreContracts <--> HaloCore
    PortalContracts <--> XChainCore
    BridgeContracts <--> RelayerCore
    AVSContracts <--> ConsensusModules
    HaloCore <--> EVMEngine
    EVMEngine <--> XChainCore
    XChainCore <--> RelayerCore
    CoreMonitor --> HaloCore
    ValidatorMonitor --> ValidatorSync
    ContractMonitor --> CoreContracts

    %% Click Events
    click SDK "https://github.com/omni-network/omni/tree/main/sdk/src"
    click Types "https://github.com/omni-network/omni/tree/main/sdk/src/types"
    click ChainUtils "https://github.com/omni-network/omni/tree/main/sdk/src/chains"
    click CoreContracts "https://github.com/omni-network/omni/tree/main/contracts/core"
    click PortalContracts "https://github.com/omni-network/omni/tree/main/contracts/portal"
    click BridgeContracts "https://github.com/omni-network/omni/tree/main/contracts/l1bridge"
    click AVSContracts "https://github.com/omni-network/omni/tree/main/contracts/avs"
    click HaloCore "https://github.com/omni-network/omni/tree/main/halo/app"
    click ConsensusModules "https://github.com/omni-network/omni/tree/main/halo/attest"
    click ValidatorSync "https://github.com/omni-network/omni/tree/main/halo/valsync"
    click EVMEngine "https://github.com/omni-network/omni/tree/main/octane/evmengine"
    click EngineKeeper "https://github.com/omni-network/omni/tree/main/octane/evmengine/keeper"
    click XChainCore "https://github.com/omni-network/omni/tree/main/lib/xchain/connect"
    click XChainProvider "https://github.com/omni-network/omni/tree/main/lib/xchain/provider"
    click RelayerCore "https://github.com/omni-network/omni/tree/main/relayer/app"
    click RelayerConfig "https://github.com/omni-network/omni/blob/main/relayer/app/config.toml.tmpl"
    click CoreMonitor "https://github.com/omni-network/omni/tree/main/monitor/app"
    click ValidatorMonitor "https://github.com/omni-network/omni/tree/main/monitor/validator"
    click ContractMonitor "https://github.com/omni-network/omni/tree/main/monitor/contract"
    click E2ETests "https://github.com/omni-network/omni/tree/main/e2e"
    click CLITools "https://github.com/omni-network/omni/tree/main/cli"
    click DevScripts "https://github.com/omni-network/omni/tree/main/scripts"

    %% Styling
    classDef sdk fill:#9966FF,stroke:#333,stroke-width:2px
    classDef contract fill:#66CC66,stroke:#333,stroke-width:2px
    classDef core fill:#3399FF,stroke:#333,stroke-width:2px
    classDef infra fill:#FF9933,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        SDK_L["SDK Component"]:::sdk
        Contract_L["Contract Component"]:::contract
        Core_L["Core Component"]:::core
        Infra_L["Infrastructure Component"]:::infra
    end
```
