Northroot Proof Engine
Core proof computation and validation library for the Northroot Proof system.
Overview
The Northroot Proof Engine provides foundational cryptographic and validation primitives for the modular proof architecture:
- PoSH (Proof of Shape): Method transformation contracts
- PoX (Proof of Execution): Run evidence and commitments
Features
- Deterministic JSON canonicalization
- SHA-256 hash computation
- ed25519 signature handling
- Input validation functions
- Data shape hashing
- OTEL ID validation (legacy compatibility)
Usage
Add to your Cargo.toml:
[]
= "0.3.0"
Quick Start
use ;
// Compute SHA-256 hash
let hash = compute_sha256;
println!;
// Validate trace ID
match validate_trace_id
CLI Demo Tool
The engine includes a CLI tool for demonstrations and validation:
# Run end-to-end workflow demo
# Benchmark hash operations
# Validate a proof JSON file
See CLI Guide for more details.
Example: Creating and Verifying a Span Commitment
use ;
use SigningKey;
use OsRng;
// Create a span commitment
let commitment = SpanCommitment ;
// Sign the commitment
let mut csprng = OsRng;
let signing_key = generate;
let signature = sign_span_commitment?;
// Verify the signature
let verifying_key = signing_key.verifying_key;
let verified = verify_span_commitment_signature?;
Performance
The engine is optimized for deterministic, fast hash computation and canonicalization. Typical performance characteristics:
- SHA-256: ~100K+ ops/sec (1KB input)
- Canonicalization: ~50K+ ops/sec
- Span Commitment Hash: ~30K+ ops/sec
Run benchmarks with:
Or use the CLI for quick performance testing:
See Benchmarks for detailed performance data.
CLI Reference
The northroot-cli tool provides several commands:
demo workflow- Demonstrates end-to-end PoSH → PoX workflowbench hash- Benchmarks hash and canonicalization operationsvalidate <file>- Validates proof JSON files
See CLI Guide for complete documentation.
Documentation
- 5W1H Executive Guide - Mathematical foundation and proof architecture
- PoSH Mini Spec - Proof of Shape specification
- PoX Mini Spec - Proof of Execution specification
- Recommended Types - Type recommendations for v0.2
- CLI Guide - Command-line tool usage
- Benchmarks - Performance characteristics and benchmarks
Current: v0.3.0
This version includes CLI tool, enhanced testing, and improved documentation. Breaking changes will require a major version bump.
Development
Setup
# Install git hooks (run once)
Pre-commit Checks
Automatically runs on commit:
- Code formatting check (
cargo fmt)
Pre-push Checks
Automatically runs before push:
- Clippy linting (
cargo clippy) - Full test suite (
cargo test) - Release build verification (
cargo build --release)
Releasing
- Update
CHANGELOG.mdwith changes - Run the release script:
# Example: ./scripts/release.sh 0.2.1 - Push the commit and tag:
GitHub Actions will automatically:
- Run full CI checks
- Publish to crates.io
- Create a GitHub release
Note: You'll need to set the CRATES_IO_TOKEN secret in GitHub repository settings.
License
MIT License - see LICENSE file for details.