saorsa-logic
Pure verification logic for the Saorsa network, designed for zkVM compatibility.
Overview
saorsa-logic extracts the core verification logic from the Saorsa network into a no_std compatible crate. This enables:
- zkVM Proofs: Run verification logic inside SP1/RISC Zero to generate proofs
- Deterministic Execution: All operations are pure and reproducible
- Minimal Dependencies: Only BLAKE3 and serde for maximum portability
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ saorsa-node │
│ (CLI, config, auto-upgrade) │
└────────────────────────────┬────────────────────────────────────┘
│
┌────────────────────────────▼────────────────────────────────────┐
│ saorsa-core │
│ (Networking, DHT, trust, storage) │
└────────────────────────────┬────────────────────────────────────┘
│
┌────────────────────────────▼────────────────────────────────────┐
│ saorsa-logic │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ attestation │ │ data │ │ merkle │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
┌────────▼────────┐
│ zkVM (SP1) │
│ Proves logic │
└─────────────────┘
Features
Attestation Module
Implements Entangled Attestation - binding node identity to software:
use ;
let public_key = ; // ML-DSA-65 public key
let binary_hash = ; // BLAKE3 of binary
let nonce = 12345u64;
// Derive EntangledId
let id = derive_entangled_id;
// Verify
assert!;
Data Module
Content-addressing and verification:
use ;
let data = b"Hello, Saorsa!";
let hash = compute_content_hash;
assert!;
Merkle Module
Merkle tree construction and proof verification:
use ;
let leaves: = .map.collect;
let root = build_tree_root;
let proof = generate_proof.unwrap;
assert!;
zkVM Usage
SP1 Guest Program
// In your SP1 guest program
use derive_entangled_id;
Feature Flags
std- Enable standard library (for native execution)alloc- Enable heap allocationzkvm- Generic zkVM optimizationssp1- SP1-specific optimizationsrisc0- RISC Zero-specific optimizationstest-utils- Testing utilities
no_std Compatibility
This crate is no_std by default:
# no_std (zkVM)
= "0.1"
# With std (native)
= { = "0.1", = ["std"] }
Security Properties
- Deterministic: Same inputs always produce same outputs
- Constant-time: Comparisons use constant-time operations
- Domain separated: Hash prefixes prevent cross-type collisions
- Collision resistant: BLAKE3 provides 256-bit security
License
MIT OR Apache-2.0