newton-prover-core

Crates.ionewton-prover-core
lib.rsnewton-prover-core
version0.1.29
created_at2025-11-14 07:42:27.751863+00
updated_at2026-01-06 17:00:45.316635+00
descriptionnewton protocol core sdk
homepage
repositoryhttps://github.com/newt-foundation/newton-prover-avs
max_upload_size
id1932432
size16,910,003
David He (Dizigen)

documentation

README

NEWTON Prover zkvm Proof Systems

The NEWTON Prover supports two zkvm proof systems: Risc0 and Sp1.

Risc0 zkvm Proof System

The Risc0 zkvm proof system is a zero-knowledge proof system that uses the Risc0 zkvm as its proof generator. The Risc0 zkvm is a zero-knowledge proof system that uses the Risc0 instruction set architecture (ISA) to generate proofs.

The expected ImageID to perform SNARK verification on-chain for the Risc0 zkvm proof system is: 4cf071b3cc25d73e77f430b65f5700dd53522dacc21c1bfc0862b2e46fda3584

Sp1 zkvm Proof System

The Sp1 zkvm proof system is a zero-knowledge proof system that uses the Sp1 zkvm as its proof generator. The Sp1 zkvm is a zero-knowledge proof system that uses the Sp1 instruction set architecture (ISA) to generate proofs.

The expected VKEY to perform SNARK verification on-chain for the Sp1 zkvm proof system is: 0021feaf3f6c78429dac7756fac5cfed39b606e34603443409733e13a1cf06cc

Database Module

The database module provides PostgreSQL integration for the Gateway with type-safe query execution and connection pooling.

Components

  • api_keys.rs: API key management with permissions, rate limiting, and expiration support
  • policy_client_owner.rs: Global ownership enforcement for policy clients (first-come-first-served model)
  • wasm_secrets.rs: Encrypted secrets storage and retrieval scoped to (policy_client, policy_data) pairs
  • permissions.rs: Permission system (RpcRead, RpcWrite, Admin)
  • mod.rs: Database manager with dual-pool architecture (deadpool-postgres + sqlx)

Features

  • Connection Pooling: Efficient deadpool-postgres and sqlx dual-pool integration
  • Offline Mode: SQLx compile-time query verification without database connection
  • Migration Management: Versioned schema migrations via sqlx-cli
  • Type Safety: Compile-time SQL query validation
  • Health Checks: Built-in database health monitoring
  • Referential Integrity: Foreign key constraints with CASCADE delete

Usage

use newton_prover_core::database::{
    initialize_database, get_database, DatabaseConfig,
    ApiKeyRepository, PolicyClientOwnerRepository, WasmSecretRepository
};

// Initialize database singleton
let config = DatabaseConfig::default();
initialize_database(config).await?;

// Access database
let db = get_database();
let pool = db.pool();

// Use repositories
let api_key_repo = ApiKeyRepository::new(db.clone());
let keys = api_key_repo.get_all_active().await?;

For database management guide, see src/database/README.md. For secrets management data model, see ../gateway/src/rpc/api/README.md.

Commit count: 0

cargo fmt