P2P Foundation
A next-generation peer-to-peer networking foundation built in Rust, featuring QUIC transport, privacy-first identity system, and fully integrated AI capabilities through Model Context Protocol (MCP) servers at each node.
๐ What's Unique About This Network and the Saorsa App
The P2P Foundation represents a paradigm shift in decentralized networking, combining cutting-edge cryptography, innovative addressing, and AI-native design to create something truly revolutionary. Here's what sets us apart:
๐ญ Three-Word Network Addresses
- Human-readable networking: Share connections with memorable phrases like
forest.lightning.compassinstead of complex technical addresses - Voice-friendly: Actually shareable over phone calls and voice chat
- 295 quintillion combinations: Massive address space (68.7B base ร 4.3B suffixes = 295.1 quintillion total)
- Zero friction onboarding: Eliminates the biggest barrier to P2P adoption
- Hybrid addressing: Base format for simplicity, extended format for massive scale
๐ก๏ธ Quantum-Resistant Security Architecture
- Future-proof cryptography: ML-KEM-768 and ML-DSA-65 (FIPS 203/204) protect against quantum threats
- Hybrid transition: Support both classical and post-quantum algorithms during migration
- Algorithm agility: Easy upgrade path as quantum-resistant standards evolve
- Military-grade protection: Defense against threats that don't even exist yet
๐ฅ Revolutionary Threshold Cryptography
- FROST protocol: Threshold signatures enable true multi-party authorization
- Dynamic membership: Add/remove people from groups without regenerating keys
- Hierarchical authority: Cryptographically enforced organizational structures
- Byzantine fault tolerance: Secure consensus even with malicious participants
- Seamless personnel changes: Swap out team members while maintaining security continuity
๐ข Cryptographically Enforced Organizations
- Verifiable hierarchies: Team leaders and structures backed by mathematics, not trust
- Granular permissions: Different access levels for different organizational roles
- Threshold governance: Require multiple approvals for sensitive operations
- Audit trails: Cryptographic proof of who authorized what and when
- Enterprise-ready: Built for real organizational security needs
๐ Git-Like DHT with Universal Version Control
- Content-addressed everything: BLAKE3 hashing provides integrity for all data
- Universal version control: Chat messages, documents, forum posts - everything is versioned
- Git semantics: Branches, commits, tags, and merges for any type of content
- Network-wide deduplication: Identical content stored once across the entire network
- Collaborative workflows: Distributed editing with conflict resolution and merge capabilities
๐ True Peer-to-Peer Communication
- No signaling servers: Direct computer-to-computer communication without intermediaries
- Ultimate privacy: Your conversations don't touch anyone else's servers
- QUIC transport: Modern, encrypted networking with built-in DoS protection
- Universal connectivity: Works across any network topology with automatic tunneling
- Enterprise-grade: ISATAP tunneling for corporate IPv6 deployment
๐ค AI-Native from the Ground Up
- MCP everywhere: Model Context Protocol server built into every node
- Distributed AI: AI agents discover and collaborate across the network
- Tool orchestration: Automatically find and execute AI tools on remote nodes
- Service discovery: AI services announce themselves and are automatically discovered
- Threshold AI governance: Cryptographic authorization for AI resource access
- Health monitoring: Enterprise-grade service health monitoring with automatic failover
๐ Universal Network Connectivity
- Intelligent protocol selection: Automatically chooses best tunneling method (6to4, Teredo, 6in4, DS-Lite, ISATAP)
- Enterprise tunneling: Built-in ISATAP support for corporate IPv6 networks
- Zero configuration: Works out of the box on any network setup
- IPv6-first design: Future-ready with comprehensive IPv4 backward compatibility
- Automatic NAT traversal: Connects through any firewall or router configuration
๐ Revolutionary User Experience
- Voice shareable: "Connect to forest lightning compass" actually works
- Zero technical knowledge: Share network access like sharing a WiFi password
- Cross-platform: Native performance on desktop, mobile, and web
- Progressive enhancement: Advanced features for power users, simple for everyone else
- Developer friendly: Build on our foundation with minimal learning curve
This isn't just another P2P network - it's a complete reimagining of how decentralized systems should work. We've solved the fundamental problems that have kept P2P networks from mainstream adoption while building in future-proof security and AI-native capabilities that will matter for decades to come.
๐๏ธ Project Structure
This is a Cargo workspace containing multiple interconnected components:
๐ฆ Core Library: Saorsa Core
The foundational P2P networking library (crates/p2p-core) providing:
- QUIC/TCP Transport: Modern, efficient networking with built-in encryption and automatic fallback
- Kademlia DHT: Complete distributed hash table with K=8 replication and network integration
- Git Content Addressing: Universal version control with BLAKE3 hashing and DHT storage
- MCP Integration: Full Model Context Protocol with health monitoring and service discovery
- Quantum-Resistant Security: Foundation for ML-KEM/ML-DSA with threshold cryptography
- Three-Word Addresses: Human-readable network addressing system
- Privacy-First Identity: Encrypted profiles with organizational support
๐๏ธ Desktop Application: Saorsa
Built with Tauri (apps/saorsa) - the flagship P2P application featuring:
- Real-time encrypted messaging with git-like version control
- Decentralized contact management with threshold groups
- Profile sharing with granular privacy controls
- AI agent integration with MCP service discovery
- Cross-platform desktop support (macOS, Windows, Linux)
- Native performance with web UI
๐ง Developer Tools
- CLI Tools (
crates/p2p-cli): Command-line utilities for network management - FFI Bindings (
crates/p2p-ffi): Enable Flutter and other language integration
๐ Quick Start
Using Saorsa Core Library
Add to your Cargo.toml:
[]
= "0.2.6"
= { = "1", = ["full"] }
use ;
async
Using Saorsa Desktop App
-
Build from source:
-
Run the desktop app:
-
Test the network:
# Run integration tests
โจ Key Features
๐ Production-Ready Security
- Quantum-resistant cryptography foundation (ML-KEM/ML-DSA ready)
- FROST threshold signatures with dynamic group membership
- Encrypted storage with multiple cipher suites
- Comprehensive identity management with organizational support
- DHT-based secure distributed storage
๐ Enterprise Network Integration
- QUIC/TCP transport with automatic protocol selection
- Kademlia DHT with K=8 replication and fault tolerance
- Complete DHT-Network integration with connection pooling
- IPv6-first design with comprehensive IPv4 tunneling support
- Bootstrap system with intelligent peer discovery
๐ค AI-Native Architecture
- Complete MCP server integration with health monitoring
- Automatic service discovery and announcement
- Distributed AI tool orchestration across nodes
- Load balancing with real-time health metrics
- Event-driven service monitoring and alerting
๐ Universal Version Control
- Git-like content addressing with BLAKE3 hashing
- Network-wide content deduplication and integrity
- Branching, tagging, and collaborative editing workflows
- DHT-integrated object storage with automatic replication
- Version control for all P2P data (messages, documents, forums)
๐ฏ Developer Experience
- Human-readable three-word addresses (
forest.lightning.compass) - Comprehensive Rust APIs with full async/await support
- Cross-platform FFI bindings for mobile development
- Extensive testing framework with 1000+ integration tests
- Production-ready benchmarking and performance monitoring
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Saorsa Desktop App โ โ Tauri-based UI
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ FROST Threshold Groups & Organizations โ โ Cryptographic teams, hierarchies
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Enhanced Identity Management โ โ Quantum-resistant profiles
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ MCP Server + Health Monitoring (AI) โ โ Tool discovery, health checks
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Git Content Addressing (Universal VCS) โ โ BLAKE3 + version control
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Kademlia DHT + Network Integration โ โ K=8 replication, fault tolerance
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Quantum Crypto Layer (ML-KEM/DSA Ready) โ โ Post-quantum security
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ QUIC/TCP Transport + Load Balancing โ โ Modern transport + fallback
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ IPv6/IPv4 Tunneling (Enterprise Ready) โ โ Universal connectivity
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Core Components
- Network: Complete P2P node with DHT integration and health monitoring
- DHT: Kademlia distributed hash table with K=8 replication and fault tolerance
- Transport: QUIC/TCP with automatic fallback, connection pooling, and load balancing
- Git Content: Universal version control with BLAKE3 hashing and DHT storage
- MCP: Full Model Context Protocol with service discovery and health monitoring
- Identity: Enhanced identity management with organizational support
- Threshold: FROST protocol implementation for cryptographic groups
- Quantum Crypto: ML-KEM/ML-DSA foundation with hybrid transition support
- Bootstrap: Intelligent peer discovery with three-word addresses
๐ Security & Privacy
The P2P Foundation implements comprehensive defense-in-depth security with quantum-resistant cryptography and threshold mechanisms:
Quantum-Resistant Cryptography
- Key Exchange: ML-KEM-768 (FIPS 203) - quantum-safe key encapsulation
- Digital Signatures: ML-DSA-65 (FIPS 204) - lattice-based signatures
- Hybrid Mode: Support for both classical and post-quantum algorithms during transition
- Algorithm Agility: Easy upgrade path as standards evolve
Threshold Cryptography
- FROST Protocol: Threshold signatures for multi-party authorization
- Dynamic Groups: Add/remove members without key regeneration
- Hierarchical Authority: Cryptographically enforced access levels
- Team Management: Leaders and groups with verifiable permissions
- Consensus Operations: Byzantine fault-tolerant group decisions
Core Security Features
- Transport encryption: End-to-end via QUIC/TLS 1.3
- Peer authentication: Dual signatures (ML-DSA + Ed25519)
- Privacy-first profiles: Encrypted data with threshold-based sharing
- Access control: Cryptographically enforced hierarchical permissions
- Rate limiting: Per-peer request throttling and DoS protection
- Audit logging: Comprehensive security event tracking
- Forward secrecy: Proactive secret refresh for long-term security
Privacy Model
- Default Privacy: All profile data encrypted by default
- Friend Network: Share decryption keys only with trusted contacts
- Granular Control: Choose what information friends can see
- Bloom Filter Discovery: Find friends without revealing contacts
- IPv6 Identity Binding: Anti-spoofing cryptographic proofs
- Threshold Access: Require t-of-n approval for sensitive operations
- Dynamic Permissions: Update access rights without re-encryption
๐ฑ Cross-Platform Support
Desktop (Tauri)
- macOS: Native .app bundle with DMG installer
- Windows: Native .exe with MSI installer
- Linux: Native binary with AppImage
Mobile/Web (Flutter via FFI)
- iOS: Native performance through FFI bindings
- Android: Native performance through FFI bindings
- Web: WebAssembly compilation for browser deployment
Server/CLI
- Linux: Optimized for edge deployment
- Docker: Containerized deployment options
๐ ๏ธ Development
Prerequisites
- Rust 1.75 or later
- Node.js 18+ (for Tauri development)
- IPv6 connectivity (native or tunneled)
Building
# Clone the repository
# Build all components
# Build desktop app specifically
# Run tests
# Run benchmarks
Testing Multi-Node Communication
# Terminal 1: Start first node
# Terminal 2: Start second node
# Terminal 3: Build and run desktop app
๐งช Comprehensive Testing Suite
The P2P Foundation includes a comprehensive test suite with over 1400+ lines of test coverage across all subsystems. The test suite validates real P2P operations, data integrity, cross-node communication, and stress testing scenarios.
๐ Quick Test Commands
# Run all tests (basic functionality)
# Run tests with detailed output
# Run specific subsystem tests
# Run integration tests only
# Run stress tests
๐ง Test Suite Architecture
The test suite is located in crates/saorsa-test-suite/ and includes:
saorsa-test-suite/
โโโ src/
โ โโโ tests/
โ โ โโโ network.rs # DHT operations, peer discovery, routing
โ โ โโโ identity.rs # Profile management, encryption, contacts
โ โ โโโ crypto.rs # Quantum-resistant crypto, Ed25519, FROST
โ โ โโโ storage.rs # Git-like DHT storage, version control
โ โ โโโ chat.rs # Messaging, channels, attachments
โ โ โโโ projects.rs # File management, collaboration workflows
โ โ โโโ discuss.rs # Forums, voting, moderation, polls
โ โ โโโ threshold.rs # FROST protocol, DKG ceremonies, groups
โ โ โโโ integration.rs # Cross-subsystem integration tests
โ โโโ utils/ # Test utilities and data verification
โ โโโ config.rs # Test configuration
๐ Test Categories
๐ Network & DHT Tests (network.rs)
Tests the core P2P networking layer with real data verification:
# Run network tests specifically
# Test components:
# - Peer discovery and routing with Kademlia DHT
# - Store/retrieve operations with data integrity checks
# - Multi-node coordination (2, 5, 10, 25, 50 nodes)
# - Cross-node data synchronization
# - Network partition recovery
# - Bootstrap system validation
# - Connection pooling and load balancing
๐ญ Identity Management Tests (identity.rs)
Validates privacy-first identity system with profile integrity:
# Test components:
# - Profile creation and encryption
# - Contact management and friend networks
# - Three-word address generation and resolution
# - Profile sharing with granular permissions
# - Cross-node profile synchronization
# - Privacy controls and access management
๐ Cryptographic Tests (crypto.rs)
Comprehensive testing of all cryptographic operations:
# Test components:
# - Ed25519 signature generation and verification
# - Quantum-resistant algorithm integration (ML-KEM, ML-DSA)
# - Key generation, encryption, and decryption workflows
# - Threshold signature schemes with FROST protocol
# - Hierarchical key management and rotation
# - Cross-node cryptographic coordination
# - Performance benchmarking for crypto operations
๐๏ธ Storage System Tests (storage.rs)
Tests the Git-like DHT storage with comprehensive version control:
# Test components:
# - Content-addressed storage with BLAKE3 hashing
# - Version control operations (commit, branch, merge, tag)
# - Merge conflict detection and resolution algorithms
# - Cross-node storage synchronization and replication
# - Storage optimization and deduplication
# - History tracking and rollback capabilities
# - Performance testing with large datasets
๐ฌ Chat System Tests (chat.rs)
Validates real-time messaging with version control integration:
# Test components:
# - Channel creation and management
# - Message encryption and delivery verification
# - File attachment handling and integrity
# - Permission-based access control
# - Cross-node message synchronization
# - Message history and version tracking
# - Stress testing with high-volume messaging
๐ Project Management Tests (projects.rs)
Tests collaborative project workflows with access control:
# Test components:
# - Project creation and file storage
# - Team member management (add/remove/promote)
# - Document access control and permissions
# - Collaboration workflows and approval processes
# - Version control integration for project files
# - Cross-node project synchronization
# - Performance testing with large projects
๐๏ธ Discussion Forum Tests (discuss.rs)
Validates forum functionality with comprehensive moderation:
# Test components:
# - Category and topic management
# - Reply threading and voting systems
# - Moderation tools and user trust levels
# - Poll creation and voting mechanisms
# - Badge systems and user achievements
# - Wiki editing with version control
# - Cross-node forum synchronization
# - Stress testing with high-activity forums
๐ Threshold Cryptography Tests (threshold.rs)
Tests advanced FROST protocol and hierarchical permissions:
# Test components:
# - Distributed Key Generation (DKG) ceremonies (2-of-3 to 7-of-10)
# - FROST signing protocol with multi-phase coordination
# - Group management (add/remove members, update threshold)
# - Key rotation and proactive security refresh
# - Hierarchical group creation with 5-level permissions
# - Byzantine fault tolerance (invalid shares, double signing, etc.)
# - Cross-node distributed threshold operations
# - Stress testing (50 DKG ceremonies + 100 signing sessions)
๐ฏ Integration Tests (integration.rs)
Cross-subsystem testing with real-world scenarios:
# Test components:
# - End-to-end workflows across all subsystems
# - Data consistency across network operations
# - Performance benchmarking of complete operations
# - Error handling and recovery mechanisms
# - Multi-user collaborative scenarios
๐ Performance & Stress Testing
Run comprehensive stress tests to validate scalability:
# High-volume operations
# Specific stress scenarios:
# Performance benchmarks
๐ Data Verification Features
All tests include comprehensive data verification:
- Round-trip integrity: Store/retrieve operations verify data integrity
- Cross-node consistency: Multi-node tests ensure data synchronization
- Cryptographic verification: All signatures and encryption validated
- Version control integrity: Git-like operations maintain history consistency
- Performance metrics: Latency, throughput, and resource usage tracking
๐ ๏ธ Test Configuration
Configure test behavior via environment variables:
# Test with different node counts
NODES=50
# Enable verbose logging
RUST_LOG=debug
# Test with different network conditions
NETWORK_DELAY=100ms
# Run specific test scenarios
TEST_SCENARIO=enterprise
๐ Test Coverage
The test suite provides:
- 1400+ lines of comprehensive test coverage
- Real P2P operations with actual network communication
- Data integrity verification for all storage and retrieval
- Multi-node coordination testing (2-50 nodes)
- Stress testing with high-volume operations
- Error scenario validation with Byzantine fault tolerance
- Performance benchmarking across all subsystems
- Cross-platform compatibility testing
๐ Continuous Integration
Tests run automatically on:
- Pull requests - All functionality validated
- Commits to main - Regression prevention
- Nightly builds - Extended stress testing
- Release candidates - Comprehensive validation
The test suite ensures the P2P Foundation maintains production-ready quality across all features and platforms.
๐ Performance
- Connection establishment: < 100ms (LAN), < 1s (Internet) with automatic protocol fallback
- Throughput: > 100 Mbps per connection via QUIC, with TCP fallback
- Memory usage: < 100MB baseline per node with intelligent caching
- Concurrent connections: 1000+ with connection pooling and load balancing
- DHT operations: < 200ms lookup, < 1s store/retrieve with K=8 replication
- Git operations: Network-wide deduplication with BLAKE3 integrity
- MCP service discovery: < 500ms with health-aware routing
- Health monitoring: Configurable intervals with sub-second alerting
๐ Documentation
- Saorsa Core Documentation - API reference
- Technical Specification - Detailed technical design
- Three-Word Addresses - Human-readable network addressing
- Address Space Analysis - Comprehensive scale analysis and IPv6 coverage
- Development Guidelines - AI assistant development guide
- Examples - Working code examples
๐๏ธ Examples
See the examples/ directory for:
- MCP Service Discovery Demo: Complete AI service discovery and orchestration
- DHT Network Integration: Multi-node DHT operations with Kademlia routing
- Git Content Addressing: Version control for distributed content
- Transport Layer Testing: QUIC/TCP transport with automatic fallback
- Health Monitoring: Service health checks and load balancing
- Threshold Cryptography: FROST protocol for multi-party authorization
- Cross-platform Development: Desktop, mobile, and web integration
See the tests/ directory for comprehensive integration tests covering all functionality.
๐ง Roadmap
โ Completed (v0.2.6)
- Core P2P networking with QUIC/TCP transport and automatic fallback
- Complete DHT integration with Kademlia routing and K=8 replication
- Git content addressing with BLAKE3 hashing and universal version control
- Full MCP integration with health monitoring and service discovery
- Network transport layer with connection pooling and load balancing
- Quantum-resistant foundation with ML-KEM/ML-DSA placeholders
- FROST threshold cryptography implementation with dynamic groups
- Comprehensive testing with 1000+ integration tests
- Production optimizations with benchmarking and monitoring
- Three-word address system for human-readable networking
- Desktop application (Saorsa) with full UI
- Enterprise security with encrypted storage and identity management
๐ In Progress
- Final quantum cryptography integration (ML-KEM, ML-DSA activation)
- Mobile app development (Flutter with FFI bindings)
- Advanced MCP orchestration for multi-node AI workflows
- Enhanced NAT traversal with additional protocols
- Performance tuning for high-scale deployments
- Advanced bootstrap strategies for network resilience
๐ Planned (v0.3.0+)
- Voice/video calling capabilities with WebRTC integration
- File sharing and synchronization with git-like workflows
- Advanced threshold governance with hierarchical authority
- Proactive secret refresh for forward security
- Byzantine fault-tolerant consensus for critical operations
- Plugin system for extensible functionality
- Advanced security auditing and compliance features
๐ค Contributing
We welcome contributions! Please see our contributing guidelines for details.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes following CLAUDE.md guidelines
- Run tests and linting
- Submit a pull request
๐ License
P2P Foundation is dual-licensed to support both open-source and commercial use:
Open Source License (AGPL-3.0)
- For open source projects, personal use, and non-commercial applications
- Requires source code disclosure for all modifications
- Network use provisions apply (Section 13)
- See LICENSE-AGPL-3.0 for full terms
Commercial License
- For proprietary applications and commercial use
- No source code disclosure required
- Professional support included
- Flexible pricing tiers (SMB, Enterprise, OEM)
- Contact: saorsalabs@gmail.com
Quick Guide: If you're building a proprietary product, charging users, or have >$1M annual revenue, you need a commercial license. See LICENSING.md for detailed guidance.
For questions, contact saorsalabs@gmail.com
๐ Links
๐ Acknowledgments
Built on top of excellent open source projects:
Building the decentralized future, one node at a time. ๐โจ