# proven-network/proven-node architecture

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

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

## Overview

##### Main Components

A. Hardware Security Layer
- TEE/Enclave Environment (AWS Nitro)
- Hardware Security Module
- Remote Attestation System

B. Core Infrastructure
- Host System
- Enclave System
- Network Layer (VSOCK components)
- Security Components (Attestation, KMS)

C. Distributed Systems
- NATS Messaging System
- Storage Systems (S3, PostgreSQL, Key-Value)
- Inter-node Communication

D. Application Layer
- V8 Runtime Environment
- Application Management
- Session Management
- SQL/Storage Abstractions

##### Component Relationships

**[Hardware Security Layer]**
- ↑↓
**[Core Infrastructure]**
- ↑↓
**[Distributed Systems]**
- ↑↓
**[Application Layer]**

##### Key Elements to Highlight

a. Security Boundaries:
- Encrypted communication channels
- Attestation verification points

b. Data Flow:
- How requests flow from external clients through security layers
- How inter-node communication works
- Demonstrate storage encryption flows

c. Component Integration:
- How the V8 runtime integrates with storage
- How NATS enables communication
- Integration with Radix DLT components

##### Specific Implementation Details

**[vsock-rpc] ←→ [core] ←→ [runtime]**
- ↑           ↑          ↑
**[host] ←→ [enclave] ←→ [applications]**

##### External Integration Points

Connections to:
- AWS Services (KMS, S3)
- Radix Network
- DNS Services
- Let's Encrypt

##### Deployment View

A section showing:
- Geographic distribution
- Node replication
- High availability setup

- Zero-trust architecture
- End-to-end encryption
- Hardware-based security
- Scalability aspects
- Application isolation

→ Synchronous calls
⇢ Asynchronous messages
⇄ Bi-directional communication

- Security boundaries
- Component types
- Protocol indicators

Keep the abstraction level high enough to be understandable but include critical security and architectural details that make this system unique.

Remember to highlight the three-tier security model:
##### Application Layer (Isolated runtimes)

This will create a comprehensive system design that accurately represents the complex security and architectural aspects of the Proven Node system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef hardware fill:#ffcccc,stroke:#ff0000
    classDef security fill:#ff9999,stroke:#ff0000
    classDef infrastructure fill:#99ccff,stroke:#0000ff
    classDef storage fill:#99ff99,stroke:#006600
    classDef application fill:#ffff99,stroke:#999900
    classDef external fill:#e6e6e6,stroke:#666666
    
    subgraph Hardware["Hardware Security Layer"]
        TEE["TEE/Enclave Environment"]:::hardware
        HSM["Hardware Security Module"]:::hardware
        Attestation["Remote Attestation"]:::security
    end

    subgraph Core["Core Infrastructure"]
        Host["Host System"]:::infrastructure
        Enclave["Enclave System"]:::infrastructure
        VSOCK["VSOCK Communication"]:::infrastructure
        KMS["Key Management System"]:::security
    end

    subgraph Distributed["Distributed Systems"]
        NATS["NATS Messaging"]:::infrastructure
        S3["S3 Storage"]:::storage
        PostgreSQL["PostgreSQL"]:::storage
        KVStore["Key-Value Store"]:::storage
    end

    subgraph Application["Application Layer"]
        V8["V8 Runtime"]:::application
        AppMgmt["Application Management"]:::application
        SessionMgmt["Session Management"]:::application
        StorageAbs["Storage Abstraction"]:::application
    end

    subgraph External["External Services"]
        RadixDLT["Radix Network"]:::external
        AWSServices["AWS Services"]:::external
        DNS["DNS Services"]:::external
        LetsEncrypt["Let's Encrypt"]:::external
    end

    %% Relationships
    TEE <--> Attestation
    TEE <--> Enclave
    Host <--> VSOCK
    VSOCK <--> Enclave
    Enclave <--> NATS
    NATS <--> AppMgmt
    AppMgmt <--> V8
    V8 <--> SessionMgmt
    SessionMgmt <--> StorageAbs
    StorageAbs <--> PostgreSQL
    StorageAbs <--> S3
    StorageAbs <--> KVStore
    KMS <--> AWSServices
    DNS <--> External
    Host <--> LetsEncrypt

    %% Click events
    click TEE "https://github.com/proven-network/proven-node/blob/master/crates/enclave/src/enclave.rs"
    click Attestation "https://github.com/proven-network/proven-node/blob/master/crates/attestation/src/lib.rs"
    click Host "https://github.com/proven-network/proven-node/blob/master/crates/host/src/main.rs"
    click VSOCK "https://github.com/proven-network/proven-node/blob/master/crates/vsock-rpc/src/lib.rs"
    click NATS "https://github.com/proven-network/proven-node/tree/master/crates/messaging-nats/src/"
    click S3 "https://github.com/proven-network/proven-node/blob/master/crates/store-s3/src/lib.rs"
    click PostgreSQL "https://github.com/proven-network/proven-node/blob/master/crates/postgres/src/lib.rs"
    click V8 "https://github.com/proven-network/proven-node/blob/master/crates/runtime/src/runtime.rs"
    click AppMgmt "https://github.com/proven-network/proven-node/blob/master/crates/applications/src/application.rs"
    click SessionMgmt "https://github.com/proven-network/proven-node/blob/master/crates/sessions/src/session.rs"
    click KMS "https://github.com/proven-network/proven-node/blob/master/crates/kms/src/lib.rs"
    click DNS "https://github.com/proven-network/proven-node/blob/master/crates/dnscrypt-proxy/src/lib.rs"

    %% Legend
    subgraph Legend
        L1["Hardware Security"]:::hardware
        L2["Security Component"]:::security
        L3["Infrastructure"]:::infrastructure
        L4["Storage"]:::storage
        L5["Application"]:::application
        L6["External Service"]:::external
    end
```
