Crate power_house

Crate power_house 

Source
Expand description

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, the sum-check protocol and the ALIEN theorem. 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 type.
  • Sum-check demonstration: the sumcheck 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 with negligible soundness error.
  • Pseudorandom number generator (PRNG): the prng 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 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.
  • ALIEN theorem blueprint: the alien 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. This module is meant to illustrate the ideas described in the ALIEN theorem statement included in the problem statement, but it does not implement a full 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:

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.

Re-exports§

pub use alien::compute_fold_digest;
pub use alien::julian_genesis_anchor;
pub use alien::julian_genesis_hash;
pub use alien::reconcile_anchors;
pub use alien::reconcile_anchors_with_quorum;
pub use alien::AnchorMetadata;
pub use alien::AnchorVote;
pub use alien::EntryAnchor;
pub use alien::LedgerAnchor;
pub use alien::Proof;
pub use alien::ProofKind;
pub use alien::ProofLedger;
pub use alien::Statement;
pub use alien::JULIAN_GENESIS_STATEMENT;
pub use consensus::consensus;
pub use sumcheck::ChainedSumProof;
pub use sumcheck::GeneralSumClaim;
pub use sumcheck::GeneralSumProof;
pub use sumcheck::ProofStats;
pub use sumcheck::SumClaim;

Modules§

alien
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.
consensus
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.
economics
Token economics scaffolding for DA layer monetization.
rollup
Rollup integration with Groth16 verification. Circuit: next = prev + tx_root (Fr) plus Pedersen Merkle inclusion of tx_root into pedersen_root bytes (public).
sumcheck
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.

Structs§

Field
A finite field defined by an odd prime modulus.
LogRecordMetadata
Metadata captured from optional comment lines in a ledger log file.
MerkleProof
Merkle inclusion proof for a single transcript digest.
MerkleProofNode
Describes a sibling hash encountered while walking a Merkle tree.
MultilinearPolynomial
Represents an n-variate multilinear polynomial via its values on {0,1}ⁿ.
ParsedLogFile
Parsed contents of a ledger log file.
SimplePrng
A deterministic stream generator derived from BLAKE2b-256.
StreamingPolynomial
Streaming representation of a multilinear polynomial over a Boolean hypercube.
Transcript
Stateful helper that derives challenges from a recorded transcript.

Functions§

build_merkle_proof
Constructs an inclusion proof for the leaf at index within leaves.
merkle_root
Computes the Merkle root for the provided leaf digests.
parse_log_file
Parses a ledger log file, tolerating optional comment lines that begin with #.
parse_transcript_record
Parses a transcript record and returns its components and stored hash.
read_fold_digest_hint
Attempts to load a fold digest hint from fold_digest.txt inside dir.
transcript_digest
Computes the deterministic digest used for transcript records.
transcript_digest_from_hex
Parses a lowercase or uppercase hex string into a transcript digest.
transcript_digest_to_hex
Converts a digest into a lowercase hex string.
verify_merkle_proof
Checks whether the proof recomputes the advertised Merkle root.
verify_transcript_lines
Verifies that a transcript record matches its stored hash digest.
write_text_series
Writes a text file to base_dir/prefix_index.txt using the provided lines.
write_transcript_record
Writes a transcript record using the provided writer function.

Type Aliases§

TranscriptDigest
Fixed-width transcript digest.