FoldDB Peer-to-Peer Networking

What is Peer-to-Peer Networking?

FoldDB's peer-to-peer (P2P) network connects individual nodes to each other without a centralized server. Each node maintains its own Fold Database, handling read and write requests according to user-defined schemas and privacy rules.

    graph TB
        %% Nodes
        A((Personal Node)) 
        B((Friend Node))
        C((Hospital Node))
        %% Schema queries and responses
        A --> |Query Personal Schema P| B
        B --> |Schema P response| A
        C --> |Query Medical Schema M| A
        A --> |Schema M response| C

How Peer-to-Peer Networking Works

Node Discovery and Connection

The P2P network establishes connections through these steps:

  1. Nodes discover each other through introduction mechanisms
  2. Nodes exchange cryptographic keys to authenticate identities
  3. Node owners establish trust relationships based on real-world trust signals
  4. Nodes grant selective permissions according to schemas

Permission Management

The system manages permissions through these mechanisms:

Mechanism Description Example
Trust Relationships Explicit connections between nodes A personal node connects to a friend's node
Selective Permissions Granular read/write access control A friend node can read social posts but has limited write capabilities
Trust Propagation Replication of trust metadata Nodes cache and share trust information to maintain system coherence

Key Benefits

The P2P network provides these benefits:

  • Distributed control - Data access and storage remain under individual node owners' control
  • No central authority - Eliminates dependency on centralized servers
  • User-defined privacy - Node owners decide whom to connect with and what data to share
  • Granular permissions - Different nodes receive different access levels based on trust
  • Tamper resistance - Append-only structure and schema checks prevent unauthorized changes

Schemas and Permissions

What are Schemas?

Schemas serve as customized blueprints that define:

  1. What data exists in the system
  2. How the data can be accessed
  3. Who can access specific data fields
  4. What operations are permitted on each field

Schema Types and Examples

Social Schema

A social schema defines social data structures and access rules:

  • Data fields - Friend lists, posts, comments
  • Access rules - Based on social proximity or mutual connections
  • Permission examples:
    • "Friends" can see private posts
    • "Friends-of-friends" can see only public posts
    • Anonymous nodes cannot see any posts

Medical Schema

A medical schema defines healthcare data structures and access rules:

  • Data fields - Patient records, lab results, diagnoses
  • Access rules - Based on professional roles and patient consent
  • Permission examples:
    • Licensed providers can modify specific medical fields
    • Patients retain read access to all personal health data
    • Automatic auditing logs each read/write event for compliance

How Schemas Enforce Permissions

Schemas enforce permissions through these mechanisms:

  1. Structural templates - Define the data fields and relationships
  2. Permission engines - Apply access rules consistently
  3. Context-specific rules - Tailor permissions to the domain (social, medical, etc.)
  4. Automatic enforcement - Ensure every data interaction follows defined rules

Implementation Details

Trust Establishment

The system establishes trust through:

  • Explicit connections - Node owners decide whom to connect with
  • Online reputation metrics - Used to evaluate unknown nodes
  • Cryptographic verification - Ensures node identity

Security Features

The P2P network maintains security through:

  • Append-only structure - Prevents unauthorized data modification
  • Strict schema checks - Ensures data consistency and limits access
  • Trust metadata replication - Maintains system coherence
  • Self-governed ecosystem - Keeps data sharing under user control