Skip to content

SOVEREIGN-NET/The-Sovereign-Network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sovereign Network - Mono Repository

A complete, self-contained repository containing all the Rust code needed to build and run ZHTP (Zero-Trust Hybrid Protocol) orchestrator nodes for the Sovereign Network.

πŸ“Œ Repository Structure

Default Branch: development

This is a monorepo - all libraries are in this repository as regular directories (not git submodules). For alpha development, all work happens here.

Git Strategy:

  • development - main development branch (default)
  • Feature branches created from development
  • All lib-* crates are regular directories in this repo

πŸ—οΈ Architecture

Identity Architecture (Seed-Anchored)

Seed is the root of trust - all identity components derive from a single seed:

  • DID: did:zhtp:{Blake3(seed || "ZHTP_DID_V1")}
  • NodeId: Blake3("ZHTP_NODE_V2:" + DID + ":" + device) β†’ 32 bytes
  • Secrets: Derived deterministically from seed
  • PQC Keypairs: Random attachments (Dilithium2, Kyber512) - can be rotated

Constructors:

ZhtpIdentity::new_unified(identity_type, age, jurisdiction, primary_device, seed?)
  • seed=None β†’ random seed (exportable for multi-device)
  • seed=Some(...) β†’ deterministic identity (same seed β†’ same DID/NodeIds)

Proof Architecture (Versioned)

V0 (Current): ProofEnvelope { version="v0", proof: ZkProof } wraps legacy proofs V1 (Planned): Typed/governed proofs with full validation

All proof serialization includes version markers for forward compatibility.

Core Libraries (lib-*)

  • lib-blockchain - Blockchain data structures and consensus
  • lib-consensus - Consensus mechanisms and validation
  • lib-crypto - Cryptographic primitives with post-quantum support
  • lib-dht - Distributed Hash Table for peer discovery
  • lib-dns - DNS resolution and management
  • lib-economy - Economic models and token management
  • lib-identity - Seed-anchored identity and authentication (ADR-0001)
  • lib-network - Network layer and mesh networking
  • lib-proofs - Versioned zero-knowledge proofs (ADR-0003)
  • lib-protocols - Protocol definitions and handlers
  • lib-storage - Distributed storage layer

Main Application

  • zhtp - ZHTP Orchestrator node (main binary)

πŸš€ Quick Start

Prerequisites

  • Rust 1.70+ (install from rustup.rs)
  • Git (for cloning the repo)

Build & Run

Linux/macOS/WSL:

# Build all crates
./build.sh

# Run a node with default config
./run-node.sh

# Run with custom config
./run-node.sh zhtp/configs/test-node2.toml

Windows (PowerShell):

# Build all crates
.\build.ps1

# Run a node with default config
.\run-node.ps1

# Run with custom config
.\run-node.ps1 -ConfigFile crates\zhtp\configs\test-node2.toml

Manual Build

# Build entire workspace in release mode
cargo build --release --workspace

# Run the orchestrator
./target/release/zhtp-orchestrator --config zhtp/configs/test-node1.toml

πŸ“‹ Configuration

Node configuration files are in zhtp/configs/:

  • test-node1.toml - Default node configuration
  • test-node2.toml - Secondary node for testing multi-node networks

Key Configuration Sections

  • Node Settings: ID, type (full/light), security level
  • Network Settings: Ports, multicast addresses, bootstrap peers
  • Mesh Networking: Hybrid mesh + TCP/IP mode
  • Crypto Settings: Post-quantum cryptography options
  • DHT Settings: Peer discovery configuration

🌐 Running a Network

To test a multi-node network:

Terminal 1:

./run-node.sh zhtp/configs/test-node1.toml

Terminal 2:

./run-node.sh zhtp/configs/test-node2.toml

Nodes will automatically discover each other via:

  • UDP multicast (224.0.1.75:37775)
  • DHT peer discovery
  • Bootstrap peer connections

πŸ”§ Development

Project Structure

sovereign-mono-repo/
β”œβ”€β”€ Cargo.toml              # Workspace configuration
β”œβ”€β”€ build.sh / build.ps1    # Build scripts
β”œβ”€β”€ run-node.sh / run-node.ps1  # Node launcher scripts
β”œβ”€β”€ lib-blockchain/         # Blockchain library
β”œβ”€β”€ lib-consensus/          # Consensus library
β”œβ”€β”€ lib-crypto/             # Crypto library
β”œβ”€β”€ lib-dht/                # DHT library
β”œβ”€β”€ lib-dns/                # DNS library
β”œβ”€β”€ lib-economy/            # Economy library
β”œβ”€β”€ lib-identity/           # Identity library
β”œβ”€β”€ lib-network/            # Network library
β”œβ”€β”€ lib-proofs/             # Proofs library
β”œβ”€β”€ lib-protocols/          # Protocols library
β”œβ”€β”€ lib-storage/            # Storage library
β”œβ”€β”€ zhtp/                   # Main orchestrator
β”‚   β”œβ”€β”€ src/                # Source code
β”‚   β”œβ”€β”€ configs/            # Configuration files
β”‚   └── Cargo.toml          # Package manifest
└── target/                 # Build artifacts (gitignored)

Building Individual Crates

# Build specific library
cargo build -p lib-crypto

# Run tests for specific crate
cargo test -p lib-network

# Build all with verbose output
cargo build --workspace --verbose

Running Tests

# Run all tests
cargo test --workspace

# Run tests with output
cargo test --workspace -- --nocapture

πŸ“Š Node Status Indicators

When a node starts successfully, you'll see:

  • βœ… Node ID - Unique identifier for this node
  • βœ… Local IP - Network interface address
  • βœ… Mesh Port - P2P communication port
  • βœ… Multicast Discovery - Active peer discovery
  • βœ… Active Components - Crypto, Network, DHT loaded
  • βœ… Broadcasting - Announcing presence every 30 seconds

πŸ” Security Features

  • Post-quantum cryptography support
  • Zero-trust security model
  • Encrypted mesh networking
  • DHT-based peer discovery (no central authority)
  • Configurable security levels (Low/Medium/High)

πŸ› οΈ Troubleshooting

Build Errors

  • Ensure Rust 1.70+ is installed: rustc --version
  • Update Rust: rustup update
  • Clean build: cargo clean && cargo build --release

Network Issues

  • Check firewall allows UDP port 37775 (multicast)
  • Check firewall allows TCP port 33444 (mesh)
  • Verify network interface supports multicast

Bootstrap Peer Timeout

  • Expected if you're the first node on the network
  • Once other nodes start, they'll discover via multicast

πŸ“ License

MIT OR Apache-2.0

πŸ‘₯ Authors

Sovereign Network Team

Contributor Role
Seth Ramsay Founder
Peter Rutherford Lead Developer
Brad Eagle Developer
David Edwards Developer
David Scott Developer
Hugo Perez Developer
Stephen Casino Developer

Need Help? Check the individual crate README files in each lib-*/ folder for library-specific documentation.

About

Zero Knowledge Hypertext Transfer Protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages