# noble-assets/noble architecture

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

- Interactive diagram: https://gitdiagram.com/noble-assets/noble
- Repository: https://github.com/noble-assets/noble

## Overview

##### Project Type & Purpose
- Noble is a blockchain application built on the Cosmos SDK. It is designed as an application-specific chain that focuses on asset issuance (real-world assets and a yield-bearing stablecoin, Noble Dollar) and cross-chain interoperability (integrating protocols like Circle’s CCTP).
- The project not only implements standard blockchain functionalities (consensus, state transitions, modules, transaction processing) but also supports external APIs (e.g., swagger documentation via the “api” directory), upgrade mechanisms, and extensive end-to-end (e2e) testing.

##### Analyzing the File Structure
- Top-level entries such as app.go, ante.go, proposal.go, and legacy.go indicate core blockchain logic that orchestrates transaction handling and state transitions.
- The “cmd” directory (with cmd/nobled/main.go) is clearly where the executable daemon or node logic is initiated.
- The “api” directory holds configuration, generated API documentation files (swagger.yaml, index.html), and scripts for API generation—suggesting the chain offers REST/gRPC interfaces for external interaction.
- Directories like “upgrade” and “jester” hint at specialized modules (for upgrades and possibly a custom asset issuance or cross-chain signaling mechanism).
- The “e2e” folder confirms comprehensive integration testing, serving as a validation of real network behaviors (simulate transactions including IBC, stablecoin operations, etc.).
- The “local_net” folder contains scripts and documentation for spinning up a stand-alone, local instance of the Noble chain, useful for development and testing.

##### Key System Components
a. Blockchain Node and Daemon:
- Main node components (cmd/nobled) where Noble’s core functionality is executed.
- Components handling consensus, peer-to-peer networking, and transaction processing.

b. Core Modules:
- Specialized modules like those seen in the “upgrade” and “jester” folders.

c. API Layer:
- A block for the API layer, as represented by the “api” directory.
- That the API provides endpoints (possibly REST/gRPC) and uses auto-generated docs (swagger.yaml) for external consumers.

d. External Integrations:
- IBC mechanism enabling cross-chain transactions.
- Integration of Circle’s Cross-Chain Transfer Protocol (CCTP) for USDC transfers.
- Components showing interactions with external explorers (e.g., mintscan) or dashboards that monitor block height and network status.

e. Infrastructure & Testing:
- Mention the local development network (“local_net”) that provides a controlled environment for testing deployments.
- E2e testing components, showing test suites validating the performance, security, and functionality of key modules.

##### Relationships & Interactions
- Between the user/API client and the API layer (e.g., transaction submission, query requests).
- Between the API layer and the blockchain node, where state changes are executed.
- Between different modules within the node (e.g., how IBC sends/receives packets or how upgrade proposals trigger changes).
- Between on-chain processes and external cross-chain protocols (like CCTP for stablecoins).
- Dependency flows (e.g., the node depending on configuration files, consensus parameters, and CI/CD pipelines from the GitHub actions).

##### Architectural Patterns & Design Principles
- That Noble is built using the modular and extensible paradigm of the Cosmos SDK, which typically follows a layered design—separating the networking, consensus, and application layers.
- Loosely-coupled architecture that allows for ongoing upgrades (tracked through the “upgrade” directory) and modular integration of new asset types or interfacing protocols.
- That robust testing (as evidenced by the extensive “e2e” directory) underpins the reliability of the system.

##### Essential Elements
- Labels for each component reflecting its role (e.g., “Noble Node (cmd/nobled)”, “API Layer”, “IBC Module”, “Upgrade Manager”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Blockchain Node
    subgraph "Blockchain Node"
        N1["Noble Node (cmd/nobled)"]:::nodeCore
    end

    %% Core Modules
    subgraph "Core Modules"
        CM1["Ante Handlers"]:::coreModule
        CM2["Transaction & State Processing"]:::coreModule
        CM3["Governance Module"]:::coreModule
        CM4["Legacy Module"]:::coreModule
    end

    %% Other Components
    UP["Upgrade Manager"]:::upgrade
    JS["Jester Module"]:::special
    API["API Layer"]:::api
    IBC["IBC Module"]:::ibc
    E2E["E2E Testing"]:::test
    LOCAL["Local Dev Network"]:::local

    %% Relationships
    API -->|"submitsTx"| N1
    N1 -->|"executes"| CM1
    N1 -->|"executes"| CM2
    N1 -->|"executes"| CM3
    N1 -->|"executes"| CM4
    N1 -->|"triggers"| UP
    N1 -->|"handlesAssetIssuance"| JS
    N1 -->|"managesIBC"| IBC
    N1 -->|"respondsToTest"| E2E
    LOCAL -->|"hosts"| N1
    N1 -->|"returnsResponse"| API

    %% Click Events for Blockchain Node & Daemon
    click N1 "https://github.com/noble-assets/noble/blob/main/cmd/nobled/main.go"

    %% Click Events for Core Modules
    click CM1 "https://github.com/noble-assets/noble/blob/main/ante.go"
    click CM2 "https://github.com/noble-assets/noble/blob/main/app.go"
    click CM3 "https://github.com/noble-assets/noble/blob/main/proposal.go"
    click CM4 "https://github.com/noble-assets/noble/blob/main/legacy.go"

    %% Click Events for Upgrade Manager
    click UP "https://github.com/noble-assets/noble/blob/main/upgrade/upgrade.go"

    %% Click Events for Specialized Module (Jester)
    click JS "https://github.com/noble-assets/noble/blob/main/jester/client.go"

    %% Click Events for API Layer
    click API "https://github.com/noble-assets/noble/blob/main/api/config.json"

    %% Click Events for IBC Module
    click IBC "https://github.com/noble-assets/noble/blob/main/ics4_wrapper.go"

    %% Click Events for Infrastructure & Testing (E2E)
    click E2E "https://github.com/noble-assets/noble/tree/main/e2e/"

    %% Click Events for Local Development Network
    click LOCAL "https://github.com/noble-assets/noble/blob/main/local_net/README.md"

    %% Styles
    classDef nodeCore fill:#f96,stroke:#333,stroke-width:2px;
    classDef coreModule fill:#a2d5ab,stroke:#333,stroke-width:2px;
    classDef upgrade fill:#fdd835,stroke:#333,stroke-width:2px;
    classDef special fill:#81d4fa,stroke:#333,stroke-width:2px;
    classDef api fill:#90caf9,stroke:#333,stroke-width:2px;
    classDef ibc fill:#ffab91,stroke:#333,stroke-width:2px;
    classDef test fill:#ce93d8,stroke:#333,stroke-width:2px;
    classDef local fill:#80cbc4,stroke:#333,stroke-width:2px;
```
