Decentralized M2M Communication Infrastructure for AI Agent Networks
ไธญๆ็ | English
๐ ๆๆกฃ: ๆถๆ่ฎพ่ฎก | API ๅ่ | ๅผๅๆๅ
Nexa-net ๆฏไธไธชๅปไธญๅฟๅ็ M2M (Machine-to-Machine) ้ไฟกๅบ็ก่ฎพๆฝ๏ผไธบ AI Agent ็ฝ็ปๆไพๅฎๅ จใ้ซๆใ็ปๆต็ๆๅกๅ็ฐไธ่ฐ็จ่ฝๅใๅฎ้็จ Sidecar Proxy ๆจกๅผๅฎ็ฐ้ไพตๅ ฅๅผ้ๆ๏ผ่ฎฉ็ฐๆ AI ๅบ็จๆ ้ไฟฎๆนไปฃ็ ๅณๅฏๆฅๅ ฅๅปไธญๅฟๅ็ฝ็ปใ
ๅปไธญๅฟๅ่บซไปฝไธ้ถไฟกไปปๅฎๅ จๅบ็ก๏ผ
- Nexa-DID - ๅบไบ W3C DID ่ง่็ๅปไธญๅฟๅ่บซไปฝไฝ็ณป
- mTLS - ๅๅ TLS ่ฎค่ฏ๏ผ็กฎไฟ้ไฟกๅฎๅ จ
- Verifiable Credentials - ๅฏ้ช่ฏๅญ่ฏ๏ผๆฏๆ่ทจๅไฟกไปปไผ ้
่ฏญไน้ฉฑๅจ็ๆบ่ฝๆๅกๅ็ฐ๏ผ
- Capability Schema - ็ปไธ็่ฝๅๆ่ฟฐ่ง่
- Semantic Router - ๅบไบๅ้็ธไผผๅบฆ็ๅคๅ ๅญ่ทฏ็ฑ
- DHT - ๅๅธๅผๅๅธ่กจ๏ผๆฏๆๅคง่งๆจก่็นๅ็ฐ
- ONNX Embedding - ๆฌๅฐๅ้ๅ๏ผๆฏๆ่ฏญไนๅน้
้ซๆง่ฝไผ ่พไธๅ่ฎฎๅๅ๏ผ
- Frame Protocol - 12 ๅญ่็ฒพ็ฎๅธงๅคด๏ผ้ถๆท่ด่ฎพ่ฎก
- Streaming RPC - ๅๅๆตๅผ RPC๏ผๆฏๆๅคง่งๆจกๅนถๅ
- LZ4/Zstd - ้ซๆง่ฝๅ็ผฉ๏ผ้ไฝๅธฆๅฎฝๆถ่
- SYN-NEXA/ACK-SCHEMA - ๆบ่ฝๅ่ฎฎๅๅๆกๆ
ๅพฎไบคๆ็ปๆตไธ่ตๆบ็ฎก็๏ผ
- State Channel - Layer 2 ็ถๆ้้๏ผๆฏๆ้ซ้ขๅพฎไบคๆ
- Micro-Receipt - ่ฝป้็บงไบคๆๅญ่ฏ๏ผ้พไธ็ป็ฎ
- Budget Controller - ้ข็ฎๆงๅถ๏ผ้ฒๆญข่ตๆบๆปฅ็จ
ๅทฅไธ็บงๅฎๅ จ้ฒๆค๏ผ
- AES-256-GCM - ๅ ๅฏๅฏ้ฅๅญๅจ๏ผๆฟไปฃ XOR ๅ ๅฏ
- SecurityManager - ็ปไธๅฎๅ จๅ่ฐๅจ๏ผๆดๅๅฎก่ฎก/ๅฏ้ฅ่ฝฎๆข/้็้ๅถ
- Audit Log - ็ปๆๅๅฎๅ จไบไปถ่ฎฐๅฝ
- Key Rotation - ่ชๅจ/ๆๅจๅฏ้ฅ่ฝฎๆขๆบๅถ
- Rate Limiting - Token Bucket + Sliding Window ้็้ๅถ
ๅคๅ่ฎฎๆฅๅ ฅ๏ผ
- REST API - 7 ไธช็ซฏ็น๏ผAxum๏ผ๏ผๆฏๆ JSON ่ฏทๆฑ/ๅๅบ
- gRPC Health - ๆ ๅ gRPC Health Checking Protocol๏ผtonic_health๏ผ
- Rust SDK - NexaClient/NexaClientBuilder๏ผ้ถๆๆฌๆฝ่ฑกๆฅๅ ฅ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Nexa-net Four-Layer Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Layer 1: Identity โ Nexa-DID, mTLS, Verifiable Credentials โ
โ Layer 2: Discovery โ Capability Schema, Semantic Router, DHT โ
โ Layer 3: Transport โ Frame Protocol, Streaming RPC, LZ4/Zstd โ
โ Layer 4: Economy โ State Channel, Micro-Receipt, Token โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Clone the repository
git clone https://github.com/ouyangyipeng/Nexa-net.git
cd Nexa-net
# Build
cargo build --release
# Run tests
cargo test --lib# Start the proxy service
cargo run --bin nexa-proxy --releaseThe proxy service will start on:
- REST API:
http://127.0.0.1:7070/v1 - gRPC:
127.0.0.1:7071
use nexa_net::{
api::sdk::{NexaClient, NexaClientBuilder},
types::Did,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Build client
let client = NexaClientBuilder::new()
.endpoint("http://localhost:7070")
.timeout_ms(5000)
.budget(100000)
.build();
// Discover services by intent
let routes = client.discover("translate text to French", 5).await?;
// Make a network call
let response = client.call("translate", b"Hello, world!".to_vec()).await?;
Ok(())
}src/
โโโ identity/ # Layer 1: Identity & Zero-Trust
โ โโโ did.rs # Nexa-DID implementation
โ โโโ key_management.rs # Ed25519/X25519 key management
โ โโโ credential.rs # Verifiable Credentials
โโโ discovery/ # Layer 2: Semantic Discovery
โ โโโ capability.rs # Capability registry
โ โโโ router.rs # Multi-factor semantic router
โ โโโ vectorizer.rs # Semantic vectorization
โ โโโ embedding/ # Embedding module
โ โโโ mod.rs # Embedder trait
โ โโโ mock.rs # Mock Embedder
โ โโโ onnx.rs # ONNX Runtime Embedder
โโโ transport/ # Layer 3: Transport Protocol
โ โโโ frame.rs # 12-byte frame protocol
โ โโโ stream.rs # Multiplexed streams
โ โโโ rpc.rs # Streaming RPC engine
โ โโโ negotiator.rs # SYN-NEXA/ACK-SCHEMA handshake
โโโ economy/ # Layer 4: Economy Layer
โ โโโ channel.rs # State channel management
โ โโโ receipt.rs # Micro-transaction receipts
โ โโโ budget.rs # Budget controller
โโโ storage/ # Persistence Layer
โ โโโ mod.rs # Storage traits
โ โโโ memory.rs # In-memory store
โ โโโ postgres.rs # PostgreSQL backend
โ โโโ redis.rs # Redis cache
โโโ security/ # Security Module
โ โโโ audit.rs # Audit logging
โ โโโ key_rotation.rs # Key rotation
โ โโโ rate_limit.rs # Rate limiting
โ โโโ secure_storage.rs # Encrypted storage
โโโ proxy/ # Nexa-Proxy daemon
โ โโโ server.rs # REST/gRPC server
โ โโโ config.rs # Configuration
โโโ api/ # SDK Interface
โโโ sdk.rs # NexaClient SDK
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Nexa-net Frame Format โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Magic (4B) โ Type (1B) โ Flags (1B) โ StreamID (2B) โ Len (4B) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 0x4E584E54 โ DATA โ 0x00 โ 0x0001 โ 1024 โ
โ "NXNT" โ ACK โ COMPRESS โ โ โ
โ โ RST โ PRIORITY โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
485 tests passed | Clippy 0 warnings | cargo fmt clean | 45 Criterion benchmarks
# Run all tests (unit + integration + HTTP E2E)
cargo test
# Run HTTP E2E tests specifically
cargo test --test e2e_http_test
# Run benchmarks
cargo bench
# Lint check
cargo clippy -- -D warningsPerformance highlights (see PERFORMANCE.md):
| Metric | Result |
|---|---|
| Route latency | ~31 ยตs (3,200x below 100ms target) |
| Channel TPS | ~9.9M ops/s (990x above 10K target) |
| JSON serialization | ~5.6M ops/s (56x above 100K target) |
| REST API health | ~1.2 ms end-to-end |
| REST API discover | ~1.4 ms end-to-end |
| Document | Description |
|---|---|
| Architecture | System architecture and design decisions |
| API Reference | REST/gRPC/SDK API documentation |
| Developer Guide | Development setup and contribution guide |
| Security | Security model and best practices |
| Deployment | Production deployment guide |
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.