# uomi-network/uomi-node architecture

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

- Interactive diagram: https://gitdiagram.com/uomi-network/uomi-node
- Repository: https://github.com/uomi-network/uomi-node

## Overview

##### Project Type and Purpose
- A Substrate-based blockchain node (“uomi”), designed to host on-chain AI economic agents, integrate IPFS storage, threshold-cryptography services, and custom EVM precompiles.

##### Main Components
- Node Binary (node/… → bin/main.rs, service.rs): the Substrate Service builder, networking, consensus, RPC.
- Runtime (runtime/uomi, runtime/finney, runtime/local): the WASM runtime with:
– Chain Extensions (chain_extensions.rs)
– Precompiles (precompiles.rs)
– Voter Bags, Pallet Weights
- Pallets (pallets/…): on-chain modules—unified-accounts, tss, ipfs, uomi-engine, base-fee, etc.
- Precompiles (precompiles/…): EVM precompiled contracts for assets, IPFS, sr25519, unified-accounts, uomi-engine.
- Chain-Extensions (chain-extensions/…): custom FRAME pallet extensions (assets, unified-accounts) and types.
- Primitives (primitives/…): shared types (governance, EVM, precompiles).
- Client Libraries (client/…):
– IPFS Manager: download/manage IPFS binaries
– Offchain API: HTTP & timestamping for offchain workers
– TSS: distributed keygen/signing, test framework
- External Services:
– IPFS network
– JSON-RPC clients (curl, frontends)
– libp2p peer network

##### Relationships & Data Flows
- Node Binary ←→ Peer Network (libp2p): block/transaction gossip
- Node Binary ←→ JSON-RPC & WS Clients: RPC endpoints (rpc.rs)
- Node Binary → Runtime (WASM): execute blocks
- Runtime → Storage DB (RocksDB): state persistence
- Runtime → Pallets: call pallet logic (unified-accounts, uomi-engine, etc.)
- Runtime → Precompiles: EVM CALLs to precompiled modules
- Pallets → Chain-Extensions: invoke offchain chain-extension calls
- Offchain Workers (in pallets/uomi-engine, collective-proxy, etc.) → Client Libraries: IPFS Manager, TSS
- Client Libraries → External IPFS or TSS network peers

##### Architectural Patterns & Principles
- Modularity via Rust workspace and Substrate FRAME
- Separation of concerns:
– On-chain logic (runtime, pallets, precompiles)
– Off-chain helpers (offchain workers, client crates)
- Extensibility: chain-extensions & precompiles as plugin layers
- No-std contexts: crates compiled with default-features=false for WASM

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Node Service & Networking
    subgraph "Node Service & Networking"
        Main["Node Binary: main.rs"]:::onchain
        Service["Service: service.rs"]:::onchain
    end

    %% On-chain Runtime
    subgraph "On-chain Runtime" 
        subgraph "Runtime Flavors"
            Uomi["Uomi Runtime"]:::onchain
            Finney["Finney Runtime"]:::onchain
            Local["Local Runtime"]:::onchain
        end
        subgraph "Pallets"
            UA["Unified Accounts Pallet"]:::onchain
            TSSP["TSS Pallet"]:::onchain
            IPFSP["IPFS Pallet"]:::onchain
            UEP["Uomi Engine Pallet"]:::onchain
            BF["Base Fee Pallet"]:::onchain
            CP["Collective Proxy Pallet"]:::onchain
        end
        subgraph "Precompiles"
            AERC["Assets ERC-20 Precompile"]:::onchain
            DL["Dispatch Lockdrop Precompile"]:::onchain
            IPFSPre["IPFS Precompile"]:::onchain
            SR["sr25519 Precompile"]:::onchain
            ECDSA["Substrate ECDSA Precompile"]:::onchain
            UAPre["Unified Accounts Precompile"]:::onchain
            UEPPre["Uomi Engine Precompile"]:::onchain
            UtilsMacro["Precompile Utils Macro"]:::onchain
            Utils["Precompile Utils"]:::onchain
        end
        subgraph "Chain-Extensions"
            CEAssets["Pallet Assets Chain-Ext"]:::onchain
            CEUA["Pallet Unified Accounts Chain-Ext"]:::onchain
        end
        Primitives["Primitives (Shared Types)"]:::onchain
    end

    %% Off-chain Modules
    subgraph "Off-chain Modules"
        OW["Offchain Workers"]:::offchain
        IPFSMgr["IPFS Manager"]:::offchain
        OffAPI["Offchain API"]:::offchain
        TSSc["TSS Client Library"]:::offchain
    end

    %% External Services
    External1["Peer Network (libp2p)"]:::external
    External2["JSON-RPC & WS Clients"]:::external
    DB["Storage DB (RocksDB)"]:::external
    External3["IPFS Network"]:::external
    External4["TSS Network"]:::external

    %% Connections
    Main <--->External1
    Main <--->External2
    Main -->Uomi
    Main -->Finney
    Main -->Local
    Uomi -->DB
    Finney -->DB
    Local -->DB
    Uomi -->UA
    Uomi -->TSSP
    Uomi -->IPFSP
    Uomi -->UEP
    Uomi -->BF
    Uomi -->CP
    Uomi -->AERC
    Uomi -->DL
    Uomi -->IPFSPre
    Uomi -->SR
    Uomi -->ECDSA
    Uomi -->UAPre
    Uomi -->UEPPre
    AERC -->UtilsMacro
    AERC -->Utils
    UA -->CEAssets
    UA -->CEUA
    OW -->IPFSMgr
    OW -->TSSc
    IPFSMgr -->External3
    TSSc -->External4

    %% Click Events
    click Main "https://github.com/uomi-network/uomi-node/blob/main/node/bin/main.rs"
    click Service "https://github.com/uomi-network/uomi-node/blob/main/node/src/uomi/service.rs"
    click Uomi "https://github.com/uomi-network/uomi-node/blob/main/runtime/uomi/src/lib.rs"
    click Finney "https://github.com/uomi-network/uomi-node/blob/main/runtime/finney/src/lib.rs"
    click Local "https://github.com/uomi-network/uomi-node/blob/main/runtime/local/src/lib.rs"
    click UA "https://github.com/uomi-network/uomi-node/blob/main/pallets/unified-accounts/src/lib.rs"
    click TSSP "https://github.com/uomi-network/uomi-node/blob/main/pallets/tss/src/lib.rs"
    click IPFSP "https://github.com/uomi-network/uomi-node/blob/main/pallets/ipfs/src/lib.rs"
    click UEP "https://github.com/uomi-network/uomi-node/blob/main/pallets/uomi-engine/src/lib.rs"
    click BF "https://github.com/uomi-network/uomi-node/blob/main/pallets/base-fee/src/lib.rs"
    click CP "https://github.com/uomi-network/uomi-node/blob/main/pallets/collective-proxy/src/lib.rs"
    click AERC "https://github.com/uomi-network/uomi-node/blob/main/precompiles/assets-erc20/src/lib.rs"
    click DL "https://github.com/uomi-network/uomi-node/blob/main/precompiles/dispatch-lockdrop/src/lib.rs"
    click IPFSPre "https://github.com/uomi-network/uomi-node/blob/main/precompiles/ipfs/src/lib.rs"
    click SR "https://github.com/uomi-network/uomi-node/blob/main/precompiles/sr25519/src/lib.rs"
    click ECDSA "https://github.com/uomi-network/uomi-node/blob/main/precompiles/substrate-ecdsa/src/lib.rs"
    click UAPre "https://github.com/uomi-network/uomi-node/blob/main/precompiles/unified-accounts/src/lib.rs"
    click UEPPre "https://github.com/uomi-network/uomi-node/blob/main/precompiles/uomi-engine/src/lib.rs"
    click UtilsMacro "https://github.com/uomi-network/uomi-node/blob/main/precompiles/utils/macro/src/lib.rs"
    click Utils "https://github.com/uomi-network/uomi-node/blob/main/precompiles/utils/src/lib.rs"
    click CEAssets "https://github.com/uomi-network/uomi-node/blob/main/chain-extensions/pallet-assets/src/lib.rs"
    click CEUA "https://github.com/uomi-network/uomi-node/blob/main/chain-extensions/unified-accounts/src/lib.rs"
    click Primitives "https://github.com/uomi-network/uomi-node/blob/main/primitives/src/lib.rs"
    click IPFSMgr "https://github.com/uomi-network/uomi-node/blob/main/client/ipfs-manager/src/lib.rs"
    click OffAPI "https://github.com/uomi-network/uomi-node/blob/main/client/offchain/src/lib.rs"
    click TSSc "https://github.com/uomi-network/uomi-node/blob/main/client/tss/src/lib.rs"

    %% Styles
    classDef onchain fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef offchain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
