# achi-coin/achi-blockchain architecture

> Architecture diagram of the GitHub repository achi-coin/achi-blockchain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/achi-coin/achi-blockchain
- Repository: https://github.com/achi-coin/achi-blockchain

## Overview

##### Core Components (Main Layer)
a. Full Node (from /achi/full_node/)
b. Farmer (from /achi/farmer/)
c. Harvester (from /achi/harvester/)
d. Timelord (from /achi/timelord/)
e. Wallet (from /achi/wallet/)
f. Introducer (from /achi/introducer/)

##### Consensus Layer
a. Proof of Space (PoSp) implementation
b. Proof of Time (PoT) implementation
c. Block validation components
d. Difficulty adjustment
- Link this to both Full Node and Timelord components

##### Network Communication Layer
- RPC interfaces (/achi/rpc/)
- Protocol definitions (/achi/protocols/)
- Server components (/achi/server/)

##### Storage Layer
- Databases and stores:
a. Block store
b. Coin store
c. Wallet store
d. Sync store
- To their respective components

##### Wallet System
- Detail the wallet subsystem:
a. Standard wallet
c. DID wallet
d. Rate Limited (RL) wallet
- Puzzle program integration

Use the following visualization guidelines:

##### Component Details
- Brief descriptions of key components
- Version compatibility information

##### External Interfaces
- GUI connection points
- API endpoints
- CLI interaction points

Key Relationships to Emphasize:
- Full Node ↔ Consensus Layer
- Farmer ↔ Harvester
- Timelord ↔ Block Validation
- Wallet ↔ Puzzle Programs
- Network Protocol Communications

- All component types
- Connection types
- Special symbols
- Version information
- State indicators

Remember to include the blockchain's key features like:
- The 21 billion coin cap
- Halving schedules
- K=32+ plot requirement
- Timelord commission structure (0.02%)

This will create a comprehensive yet understandable representation of the Achi blockchain system architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Components
    subgraph Core
        FN[Full Node]:::core
        FR[Farmer]:::core
        HV[Harvester]:::core
        TL[Timelord]:::core
        WL[Wallet]:::core
        IN[Introducer]:::core
    end

    %% Consensus Layer
    subgraph Consensus
        POS[Proof of Space]:::consensus
        POT[Proof of Time]:::consensus
        BV[Block Validation]:::consensus
        DA[Difficulty Adjustment]:::consensus
        BC[Block Creation]:::consensus
    end

    %% Network Layer
    subgraph Network
        RPC[RPC Interfaces]:::network
        PROT[Protocol Definitions]:::network
        SRV[Server Implementation]:::network
    end

    %% Storage Layer
    subgraph Storage
        BS[Block Store]:::storage
        CS[Coin Store]:::storage
        WS[Wallet Store]:::storage
        SS[Sync Store]:::storage
    end

    %% Wallet System
    subgraph "Wallet System"
        STD[Standard Wallet]:::wallet
        CCW[Colored Coin Wallet]:::wallet
        DIDW[DID Wallet]:::wallet
        RLW[Rate Limited Wallet]:::wallet
        PP[Puzzle Programs]:::wallet
        WSM[Wallet State Manager]:::wallet
    end

    %% Additional Components
    subgraph "Additional Components"
        BCI[Blockchain Implementation]:::additional
        MM[Mempool Manager]:::additional
        NPT[Network Protocol Types]:::additional
    end

    %% Relationships
    FN --> BV
    FN --> BC
    FR --> HV
    TL --> POT
    TL --> BV
    WL --> PP
    FN --> MM
    BV --> BC
    POS --> BV
    POT --> BV
    DA --> BC
    RPC --> SRV
    PROT --> SRV
    FN --> BS
    FN --> CS
    WL --> WS
    FN --> SS
    WL --> STD
    WL --> CCW
    WL --> DIDW
    WL --> RLW
    WSM --> WL
    BCI --> FN
    NPT --> PROT

    %% Click Events
    click FN "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/full_node/full_node.py"
    click FR "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/farmer/farmer.py"
    click HV "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/harvester/harvester.py"
    click TL "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/timelord/timelord.py"
    click WL "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/wallet.py"
    click IN "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/introducer/introducer.py"
    click BV "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/consensus/block_body_validation.py"
    click DA "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/consensus/difficulty_adjustment.py"
    click POS "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/types/blockchain_format/proof_of_space.py"
    click BC "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/consensus/block_creation.py"
    click RPC "https://github.com/Achi-Coin/achi-blockchain/tree/master/achi/rpc/"
    click PROT "https://github.com/Achi-Coin/achi-blockchain/tree/master/achi/protocols/"
    click SRV "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/server/server.py"
    click BS "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/full_node/block_store.py"
    click CS "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/full_node/coin_store.py"
    click WS "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/wallet_coin_store.py"
    click SS "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/full_node/sync_store.py"
    click STD "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/wallet.py"
    click CCW "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/cc_wallet/cc_wallet.py"
    click DIDW "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/did_wallet/did_wallet.py"
    click RLW "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/rl_wallet/rl_wallet.py"
    click PP "https://github.com/Achi-Coin/achi-blockchain/tree/master/achi/wallet/puzzles/"
    click BCI "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/consensus/blockchain.py"
    click MM "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/full_node/mempool_manager.py"
    click NPT "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/protocols/protocol_message_types.py"
    click WSM "https://github.com/Achi-Coin/achi-blockchain/blob/master/achi/wallet/wallet_state_manager.py"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,stroke-width:2px
    classDef consensus fill:#2ecc71,stroke:#27ae60,stroke-width:2px
    classDef network fill:#e67e22,stroke:#d35400,stroke-width:2px
    classDef storage fill:#9b59b6,stroke:#8e44ad,stroke-width:2px
    classDef wallet fill:#f1c40f,stroke:#f39c12,stroke-width:2px
    classDef additional fill:#95a5a6,stroke:#7f8c8d,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Consensus]:::consensus
        L3[Network]:::network
        L4[Storage]:::storage
        L5[Wallet]:::wallet
        L6[Additional]:::additional
    end
```
