power_house 0.2.2

Deterministic sum-check proofs, commitment-bound sparse verification, and quorum ledger tooling.
Documentation
#![deny(missing_docs)]

//! The design philosophy underlying `power_house` is pedagogical, yet mathematically rigorous.
//! Each module encapsulates a discrete concept in modern computational complexity theory,
//! illustrating how modest abstractions compose into a cohesive proof infrastructure.
//!
//! This crate aspires to bridge gaps between theoretical exposition and practical engineering,
//! serving both as a didactic resource and a foundation for future cryptographic research.
//! # power_house
//!
//! **Power-House** is a Rust crate that showcases a set of cryptographic
//! and verification primitives inspired by interactive proof systems and the
//! sum-check protocol. The goal of this crate is to
//! demonstrate how one can build powerful proof systems and consensus logic
//! with a minimal dependency surface while still leaning on modern hash
//! primitives for tamper evidence.
//!
//! ## Features
//!
//! * **Finite field arithmetic** via the [`Field`](field/struct.Field.html) type.
//! * **Sum-check demonstration**: the [`sumcheck`](sumcheck/index.html) module
//!   contains functions to compute the true sum of a small bivariate polynomial
//!   over the Boolean hypercube, build a one-shot claim, and verify it. Security
//!   depends on the selected field, round count, transcript model, and protocol.
//! * **Pseudorandom number generator (PRNG)**: the [`prng`](prng/index.html)
//!   module exposes a compact BLAKE2b-256 expander that derives deterministic
//!   Fiat–Shamir challenges from transcripts.  It serves as a stand-in for a
//!   verifiable random function (VRF) when exploring protocol blueprints.
//! * **Byzantine-fault-tolerant consensus**: the [`consensus`](consensus/index.html)
//!   module provides a trivial consensus primitive that takes a set of binary
//!   votes and returns whether the threshold has been met.  It is intended as
//!   a pedagogical example of how one might aggregate prover responses.
//! * **JULIAN protocol blueprint**: the [`julian`](julian/index.html) module
//!   outlines, through documentation and type stubs, how one could combine
//!   interactive proofs, VRF randomness, consensus and provability logic
//!   into a globally verifiable proof ledger. It is a protocol blueprint and
//!   does not by itself implement a complete production ledger.
//!
//! ## Usage
//!
//! The following example demonstrates how to compute and verify a sum-check
//! claim for the demo polynomial \f$\,f(x_1,x_2) = x_1 + x_2 + 2 x_1 x_2\,\) modulo a
//! small prime \f$p\,\) using this crate:
//!
//! ```rust
//! use power_house::{Field, sumcheck::SumClaim};
//!
//! // Choose a prime field of order 101.
//! let field = Field::new(101);
//!
//! // Prover creates an honest claim with default round count k=8.
//! let claim = SumClaim::prove_demo(&field, 8);
//! // The verifier checks that the claim is valid.
//! assert!(claim.verify_demo());
//! ```
//!
//! The crate can be extended with richer protocols by building on these
//! primitives.  It is intentionally minimal and does not offer a complete
//! blockchain or proof ledger implementation.

pub mod consensus;
mod data;
pub mod economics;
mod field;
mod io;
pub mod julian;
mod log_parser;
mod merkle;
mod multilinear;
mod prng;
pub mod rollup;
pub mod sparse_sumcheck;
mod streaming;
pub mod sumcheck;
mod transcript;

/// CLI command helpers for migration and deterministic artifacts.
#[cfg(feature = "net")]
pub mod commands;
#[cfg(feature = "net")]
pub mod net;

pub use consensus::consensus;
pub use data::{
    compute_digest as transcript_digest, digest_from_hex as transcript_digest_from_hex,
    digest_to_hex as transcript_digest_to_hex, parse_record as parse_transcript_record,
    verify_record_lines as verify_transcript_lines, write_record as write_transcript_record,
    TranscriptDigest,
};
pub use field::Field;
pub use io::write_text_series;
pub use julian::{
    compute_fold_digest, julian_genesis_anchor, julian_genesis_hash, reconcile_anchors,
    reconcile_anchors_with_quorum, AnchorMetadata, AnchorVote, EntryAnchor, LedgerAnchor, Proof,
    ProofKind, ProofLedger, Statement, JULIAN_GENESIS_STATEMENT,
};
pub use log_parser::{parse_log_file, read_fold_digest_hint, LogRecordMetadata, ParsedLogFile};
pub use merkle::{
    build_proof as build_merkle_proof, merkle_root, verify_proof as verify_merkle_proof,
    MerkleProof, MerkleProofNode,
};
pub use multilinear::MultilinearPolynomial;
pub use prng::SimplePrng;
pub use sparse_sumcheck::{
    CommittedSparsePolynomial, CommittedSparseProof, SeededSparseProof, SeededSparseSpec,
    SparseMonomial, SparseProofError, SparseVerificationReport,
};
pub use streaming::StreamingPolynomial;
pub use sumcheck::{ChainedSumProof, GeneralSumClaim, GeneralSumProof, ProofStats, SumClaim};
pub use transcript::Transcript;