# cosmos/ibc-go architecture

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

- Interactive diagram: https://gitdiagram.com/cosmos/ibc-go
- Repository: https://github.com/cosmos/ibc-go

## Overview

##### Main Components

a) Core IBC Layer:
- Client Module (02-client)
- Connection Module (03-connection)
- Channel Module (04-channel)
- Port Module (05-port)
- Commitment Module (23-commitment)
- Host Module (24-host)

b) Applications Layer:
- Transfer Module (ICS-20)
- Interchain Accounts Module (ICS-27)

c) Middleware Layer:
- Fee Middleware (ICS-29)
- Callbacks Middleware

d) Light Clients:
- Tendermint Client (07-tendermint)
- Solo Machine Client (06-solomachine)
- Localhost Client (09-localhost)
- Wasm Client (08-wasm)

**┌─────────────────────────── Applications Layer ───────────────────────────┐**

- ┌─────────────┐    ┌────────────────────┐    ┌──────────────┐      │
- Transfer  │    │ Interchain Accounts│    │  Custom Apps  │      │
- ┘    └────────────────────┘    └──────────────┘      │

- Middleware Layer ───────────────────────────┤

- ┌─────────────┐    ┌────────────────────┐                          │
- Fee     │    │     Callbacks      │                          │
- ┘    └────────────────────┘                          │

- Core Layer ──────────────────────────────┤

- ┌─────────────┐    ┌────────────────┐    ┌────────────┐           │
- Client    │    │   Connection   │    │  Channel   │           │
- ┘    └────────────────┘    └────────────┘           │

- ┌─────────────┐    ┌────────────────┐    ┌────────────┐           │
- Port     │    │   Commitment   │    │    Host    │           │
- ┘    └────────────────┘    └────────────┘           │

- Light Clients ─────────────────────────────┤

- ┌─────────────┐    ┌────────────────┐    ┌────────────┐           │
- Tendermint │    │  Solo Machine  │    │  Localhost │           │
- ┘    └────────────────┘    └────────────┘           │

- ┘

##### Connection Flow Representation

- Packet flow between modules
- Authentication and verification paths
- State transitions
- Cross-chain communication patterns

##### Additional Elements

Include:
- Version information (current: v7, v8, v9 support)
- Key interfaces between components
- State storage indicators
- External integration points

##### Implementation Details

Show:
- Keeper interfaces
- Message handling flows
- Protocol handshake sequences
- Proof verification paths
- State management patterns

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef applications fill:#90EE90,stroke:#333,stroke-width:2px
    classDef middleware fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef lightclients fill:#DDA0DD,stroke:#333,stroke-width:2px
    
    %% Applications Layer
    subgraph Applications
        Transfer["Transfer"]:::applications
        ICA["Interchain Accounts"]:::applications
        CustomApps["Custom Apps"]:::applications
    end
    
    %% Middleware Layer
    subgraph Middleware
        Fee["Fee Middleware"]:::middleware
        Callbacks["Callbacks"]:::middleware
    end
    
    %% Core Layer
    subgraph Core
        Client["Client"]:::core
        Connection["Connection"]:::core
        Channel["Channel"]:::core
        Port["Port"]:::core
        Commitment["Commitment"]:::core
        Host["Host"]:::core
    end
    
    %% Light Clients Layer
    subgraph LightClients
        Tendermint["Tendermint"]:::lightclients
        SoloMachine["Solo Machine"]:::lightclients
        Localhost["Localhost"]:::lightclients
        Wasm["Wasm"]:::lightclients
    end
    
    %% Relationships
    Applications --> Middleware
    Middleware --> Core
    Core --> LightClients
    
    %% Click events for component mapping
    click Transfer "https://github.com/cosmos/ibc-go/tree/main/modules/apps/transfer/"
    click ICA "https://github.com/cosmos/ibc-go/tree/main/modules/apps/27-interchain-accounts/"
    click Fee "https://github.com/cosmos/ibc-go/tree/main/modules/apps/29-fee/"
    click Callbacks "https://github.com/cosmos/ibc-go/tree/main/modules/apps/callbacks/"
    click Client "https://github.com/cosmos/ibc-go/tree/main/modules/core/02-client/"
    click Connection "https://github.com/cosmos/ibc-go/tree/main/modules/core/03-connection/"
    click Channel "https://github.com/cosmos/ibc-go/tree/main/modules/core/04-channel/"
    click Port "https://github.com/cosmos/ibc-go/tree/main/modules/core/05-port/"
    click Commitment "https://github.com/cosmos/ibc-go/tree/main/modules/core/23-commitment/"
    click Host "https://github.com/cosmos/ibc-go/tree/main/modules/core/24-host/"
    click Tendermint "https://github.com/cosmos/ibc-go/tree/main/modules/light-clients/07-tendermint/"
    click SoloMachine "https://github.com/cosmos/ibc-go/tree/main/modules/light-clients/06-solomachine/"
    click Localhost "https://github.com/cosmos/ibc-go/tree/main/modules/light-clients/09-localhost/"
    click Wasm "https://github.com/cosmos/ibc-go/tree/main/modules/light-clients/08-wasm/"
    
    %% Legend
    subgraph Legend
        L1["Applications"]:::applications
        L2["Middleware"]:::middleware
        L3["Core"]:::core
        L4["Light Clients"]:::lightclients
    end
```
