# patrickb-01/omnicache architecture

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

- Interactive diagram: https://gitdiagram.com/patrickb-01/omnicache
- Repository: https://github.com/patrickb-01/omnicache

## Overview

Key Components to Include:

##### Network Architecture
- Two distinct node types:
- Genesis Node (first/master node)
- Client Nodes (regular participants)

##### Core Components per Node Type

Genesis Node:
- Blockchain Management (blockchain_G.py)
- P2P Communication (p2p_G.py)
- Testing Module (testing_G.py)

Client Node:
- Blockchain Interface (blockchain_C.py)
- P2P Communication (p2p_C.py)
- GUI Layer (gui.py)
- Driver/Main Application (driver.py)

##### External Integration Points
- Go Ethereum™ Blockchain
- Smart Contracts (Solidity/Remix)

##### Layer Organization
- Top Layer: User Interface (GUI)
- Middle Layer: Core Logic (Blockchain & P2P)
- Bottom Layer: Storage & Network Infrastructure

##### Data Flow Representation
- File Storage Flow
- Omnie Currency Transactions
- P2P Communication Paths
- Smart Contract Interactions

- Blue: User Interface Components
- Green: Blockchain Components
- Yellow: P2P Network Components
- Purple: Storage Components
- Red: Smart Contract Integration

Key Elements to Highlight:

##### File Operations
- Upload Process
- Encryption Flow
- Distribution Across Nodes
- Retrieval Process

##### Currency System
- Omnie Transaction Flow
- Smart Contract Execution
- Payment Verification

##### Security Layer
- Encryption Mechanisms
- Blockchain Verification
- P2P Security

Specific Instructions:

##### A high-level overview showing the network topology
- Genesis Node at the center
- Client Nodes in a circular pattern around it
- P2P connections as a mesh network

- File Storage Process
- Currency Transaction Flow
- Node Communication Protocol

##### A separate section showing the interaction with Ethereum
- Smart Contract Integration
- Blockchain Verification Process
- Currency Management

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef genesis fill:#f9d,stroke:#333,stroke-width:2px
    classDef client fill:#adf,stroke:#333,stroke-width:2px
    classDef ui fill:#9cf,stroke:#333,stroke-width:2px
    classDef blockchain fill:#9f9,stroke:#333,stroke-width:2px
    classDef p2p fill:#ff9,stroke:#333,stroke-width:2px
    classDef storage fill:#c9f,stroke:#333,stroke-width:2px
    classDef ethereum fill:#f99,stroke:#333,stroke-width:2px

    %% Genesis Node
    subgraph GenesisNode["Genesis Node"]
        BM["Blockchain Management"]:::blockchain
        P2PG["P2P Communication"]:::p2p
        TM["Testing Module"]:::blockchain
    end
    click BM "https://github.com/PatrickB-01/OmniCache/blob/main/Genesis Node/blockchain_G.py"
    click P2PG "https://github.com/PatrickB-01/OmniCache/blob/main/Genesis Node/p2p_G.py"
    click TM "https://github.com/PatrickB-01/OmniCache/blob/main/Genesis Node/testing_G.py"

    %% Client Nodes
    subgraph ClientNode["Client Node"]
        GUI["GUI Layer"]:::ui
        BI["Blockchain Interface"]:::blockchain
        P2PC["P2P Communication"]:::p2p
        Driver["Driver/Main App"]:::client
    end
    click GUI "https://github.com/PatrickB-01/OmniCache/blob/main/Client/gui.py"
    click BI "https://github.com/PatrickB-01/OmniCache/blob/main/Client/blockchain_C.py"
    click P2PC "https://github.com/PatrickB-01/OmniCache/blob/main/Client/p2p_C.py"
    click Driver "https://github.com/PatrickB-01/OmniCache/blob/main/Client/driver.py"

    %% UI Resources
    subgraph UIResources["UI Resources"]
        Fonts["Font Assets"]:::ui
        Images["Image Assets"]:::ui
    end
    click Fonts "https://github.com/PatrickB-01/OmniCache/tree/main/Client/Fonts/"
    click Images "https://github.com/PatrickB-01/OmniCache/tree/main/Client/Images/"

    %% External Systems
    ETH["Ethereum Blockchain"]:::ethereum
    SC["Smart Contracts"]:::ethereum

    %% Connections
    GUI --> Driver
    Driver --> BI
    Driver --> P2PC
    BI --> P2PC
    P2PC <--> P2PG
    BM <--> P2PG
    TM --> BM
    BM <--> ETH
    ETH <--> SC
    GUI --> Fonts
    GUI --> Images

    %% Legend
    subgraph Legend
        L1["UI Component"]:::ui
        L2["Blockchain Component"]:::blockchain
        L3["P2P Component"]:::p2p
        L4["Client Component"]:::client
        L5["Genesis Component"]:::genesis
        L6["Ethereum Integration"]:::ethereum
    end
```
