Overview
This section provides detailed documentation of NCN Network v2's architecture, from high-level system design to specific implementation details.
Architecture Documentation
High-level system design including:
Component responsibilities
Data flow patterns
Design principles
Scalability considerations
Network communication patterns:
P2P network structure (Kademlia DHT)
Service discovery mechanisms
gRPC communication channels
Multi-protocol client interfaces
Blockchain payment integration:
End-to-end payment sequence
Fee calculation and distribution
Smart contract interactions
Transaction confirmation
Validator consensus mechanism:
Preprocessing validation
Completion validation
M-of-N signature scheme
Validator reputation and slashing
Security architecture:
Threat model
Sandboxed execution
Cryptographic signing
Access control
Quick Reference
System Diagram
Component Summary
Gateway Node
Rust, Tokio, Tonic
Request routing, payments
gRPC, HTTP, WebSocket
Compute Node
Rust, Python
Model execution
gRPC (to Gateway)
P2P Registry
Rust, libp2p
Coordination, validation
gRPC, P2P
Smart Contracts
Solidity, Foundry
Payment handling
Ethereum ABI
Communication Protocols
gRPC
Service-to-service
50050, 50051
HTTP REST
Client requests
8080
WebSocket
Real-time updates
9000
libp2p
P2P coordination
8828
JSON-RPC
Blockchain
External
Data Flow Overview
Design Principles
1. Decentralization
No single point of failure
P2P coordination via DHT
Multiple gateway and compute nodes
2. Security First
Sandboxed model execution
Cryptographic attestations
Payment verification
3. Scalability
Horizontal scaling of compute nodes
Async I/O with Tokio
Efficient binary protocols (protobuf)
4. Transparency
On-chain payment records
Validator signatures
Execution logs
5. Operator Economics
Gateway operators earn routing fees
Compute operators earn execution fees
Validators earn consensus fees
Technology Stack
Backend Services
Runtime
Tokio
Async runtime
RPC
Tonic
gRPC framework
Web
Axum
HTTP server
P2P
libp2p
P2P networking
Crypto
ethers-rs
Ethereum integration
Serialization
Protobuf
Binary encoding
Smart Contracts
Solidity
Contract language
Foundry
Development framework
OpenZeppelin
Security libraries
Model Execution
Python
Executor runtime
PyTorch
ML framework
seccomp
Syscall filtering
Landlock
Filesystem isolation
Next Steps
Dive deeper into specific architecture topics:
System Overview - Complete system design
Payment Flow - Payment mechanics
Security Model - Security architecture
Last updated
