# eosio/eos architecture

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

- Interactive diagram: https://gitdiagram.com/eosio/eos
- Repository: https://github.com/eosio/eos

## Overview

##### Project Type and Main Purpose
- EOSIO is a blockchain infrastructure platform designed for high-performance, secure, and scalable decentralized applications.
- Its design supports smart contracts via WebAssembly, rapid block production, and an extensible plugin ecosystem (e.g., chain_api_plugin, history_plugin, net_plugin).

##### Main Components
- Core Node Process (nodeos): The primary executable that runs the blockchain node and manages consensus, block production, and state transitions.
- APIs and Plugins: A variety of plugins (chain_api_plugin, history_api_plugin, producer_plugin, etc.) provide interfaces for external access and extend nodeos functionality.
- Wallet and Client Tools: Cleos (CLI for communicating with nodeos) and keosd (manages wallet keys) form the client layer.
- Smart Contracts: Located in the contracts directory, they define on-chain business logic.
- Libraries: Under directories like “libraries”, “chain”, “chain_kv”, “state_history”, etc., these provide core blockchain functionality and utility routines.
- Build and CI/CD Infrastructure: Directories such as .cicd, scripts, and CMakeModules support the build pipeline and automated testing/deployment.
- Testing and Demos: Directories like “tests” and “tutorials” offer integration tests, unit tests, and usage examples.

##### Relationships and Interactions
- Nodeos runs as a central engine interacting with diverse plugins that extend functionality (e.g., APIs, logging, network, and history management).
- Cleos and keosd act as client and wallet services interfacing with nodeos via RPC calls.
- The libraries (chain, chain_kv, etc.) form the lower-level engine for state management, consensus, and transaction execution.
- CI/CD systems, Dockerfiles, and scripts integrate all these components for compiling, testing, and packaging.
- Smart contracts interact with nodeos and deployed plugins via standardized ABI and WebAssembly interfaces.

##### Architectural Patterns and Key Technologies
- Modular Plugin Architecture: Plugins are used extensively to add or modify functionality, promoting separation of concerns.
- Layered/MVC-like Pattern: The core blockchain engine (model) is separated from the APIs/clients (view/controller) that interact with users and external systems.
- Microservice-like Components (if considering external tools like cleos/keosd as separate executables) with well-defined interfaces.
- CI/CD Integration: Automated build scripts, test frameworks, and cross-platform Docker configurations ensure uniformity across environments.
- Extensive use of CMake for configurable builds, along with automated scripts tailored for various OS targets (Ubuntu, CentOS, MacOS).

##### Elements
- Use clear labels for each component:
◦ “Nodeos – Blockchain Node Engine”, “Core Libraries”, “Plugins (Chain API, History, Net, etc.)”, “Cleos (CLI)”, “Keosd (Wallet)”, “Smart Contracts”, “CI/CD Pipeline”, etc.
- Annotations: Add notes about supported platforms and integration points (e.g., “Interacts with the EOS VM for smart contract execution” or “Handles WebAssembly smart contracts”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer: Client Tools & Smart Contracts
    subgraph "Client & Smart Contracts Layer"
        Cleos("Cleos (CLI)"):::executable
        Keosd("Keosd (Wallet Daemon)"):::executable
        SC("Smart Contracts"):::contracts
    end

    %% Middle Layer: Nodeos and Plugins
    subgraph "Blockchain Node & Plugins"
        Nodeos("Nodeos - Blockchain Node Engine"):::executable
        subgraph "Plugins"
            ChainAPI("Chain API Plugin"):::plugin
            HistoryAPI("History API Plugin"):::plugin
            Producer("Producer Plugin"):::plugin
            NetAPI("Net API Plugin"):::plugin
            Net("Net Plugin"):::plugin
            Other("Other Plugins"):::plugin
        end
    end

    %% Base Layer: Core Libraries
    subgraph "Core Libraries Layer"
        Libraries("Core Libraries"):::library
    end

    %% Side Component: Build & CI/CD Infrastructure
    subgraph "Build & CI/CD Infrastructure"
        CICD("CI/CD Pipeline"):::cicd
        BuildScripts("Build Scripts & CMake"):::cicd
        Testing("Testing & Demos"):::test
    end

    %% Interactions between Layers
    Cleos -->|"RPC" | Nodeos
    Keosd -->|"WalletRPC" | Nodeos
    SC -->|"Interact" | Nodeos

    Nodeos -->|"Integrates" | ChainAPI
    Nodeos -->|"Integrates" | HistoryAPI
    Nodeos -->|"Integrates" | Producer
    Nodeos -->|"Integrates" | NetAPI
    Nodeos -->|"Integrates" | Net
    Nodeos -->|"Integrates" | Other

    Nodeos -->|"BuiltOn" | Libraries

    CICD -->|"TriggersBuild" | Nodeos
    BuildScripts -->|"Compiles" | Nodeos
    BuildScripts -->|"Compiles" | Libraries
    Testing -->|"Tests" | Nodeos
    Testing -->|"Tests" | Libraries

    %% Styling Classes
    classDef executable fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef plugin fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef contracts fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef library fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef cicd fill:#F5CBA7,stroke:#E67E22,stroke-width:2px;
    classDef test fill:#FAD7A0,stroke:#D35400,stroke-width:2px;

    %% Click Events
    click Nodeos "https://github.com/eosio/eos/blob/master/programs/nodeos/main.cpp"
    click ChainAPI "https://github.com/eosio/eos/blob/master/plugins/chain_api_plugin/chain_api_plugin.cpp"
    click HistoryAPI "https://github.com/eosio/eos/blob/master/plugins/history_api_plugin/history_api_plugin.cpp"
    click Producer "https://github.com/eosio/eos/blob/master/plugins/producer_plugin/producer_plugin.cpp"
    click NetAPI "https://github.com/eosio/eos/blob/master/plugins/net_api_plugin/net_api_plugin.cpp"
    click Net "https://github.com/eosio/eos/blob/master/plugins/net_plugin/net_plugin.cpp"
    click Cleos "https://github.com/eosio/eos/blob/master/programs/cleos/main.cpp"
    click Keosd "https://github.com/eosio/eos/blob/master/programs/keosd/main.cpp"
    click SC "https://github.com/eosio/eos/tree/master/contracts/"
    click Libraries "https://github.com/eosio/eos/tree/master/libraries/chain/"
    click CICD "https://github.com/eosio/eos/tree/master/.cicd/"
    click BuildScripts "https://github.com/eosio/eos/tree/master/scripts/"
    click Testing "https://github.com/eosio/eos/tree/master/tests/"
```
