Plonky3

Plonky3 is a Rust framework for constructing polynomial-based proof systems. Sahyadri uses it as the proving substrate, not as a turnkey proof system. The protocol defines its own AIRs, its own recursion strategy, and its own chain-aggregation pipeline on top of Plonky3's primitives.

1. What Plonky3 Is

Plonky3 is not a blockchain. It is not a specific proof system in the sense that Groth16 is a proof system. It is a library of cryptographic building blocks that a protocol composes into a proof system suited to its needs.

Plonky3 provides:

  - Finite field arithmetic over multiple fields
      Goldilocks (2^64 - 2^32 + 1), BabyBear, Mersenne31
  - Hash functions with verifier-friendly constraint counts
      Poseidon, Poseidon2, Keccak, BLAKE3 (as a constant-density AIR)
  - Polynomial commitment schemes
      FRI, batch-STARK over FRI, WHIR-style variants
  - AIR abstraction for constraint systems
      Expressing computation as transition + boundary constraints
  - Recursion primitives
      Composition of proofs, verifier circuit generation
  - Standard proof-system infrastructure
      Fiat-Shamir, Merkle commitment, proof serialization

Plonky3 does NOT provide:

  - A fixed proof system you can call (like Groth16)
  - A blockchain or ledger
  - A state model
  - A consensus protocol
  - A specific AIR for your use case

Every protocol that uses Plonky3 must define its own AIRs. Every claim of "Sahyadri uses Plonky3 for X" is shorthand for "Sahyadri defines an AIR for X using Plonky3's field, hash, and PCS primitives, and produces a proof with Plonky3's prover."

2. The Four Proof Types

Sahyadri produces four distinct proof types. Each is a custom AIR composed over Plonky3's primitives. Each has different constraint counts, proof sizes, and verification costs.

Proof type              Constraint system            Typical verify time

Dilithium-3 signature   ~30,000 constraints/sig       ~35 ms for N=2..8
  INPUT:  ML-DSA-65 signature, message, public key
  OUTPUT: bool (valid/invalid)
  USE:    Block-level batch proofs

SMT state proof         ~5,000 constraints/path       <1 ms for 256-level path
  INPUT:  Merkle path, leaf, root
  OUTPUT: bool (inclusion/exclusion)
  USE:    Light-client state verification

Poseidon2 hash proof    ~300 constraints/permute      ~1 ms
  INPUT:  Preimage, expected hash output
  OUTPUT: bool (hash matches)
  USE:    Hash-correctness for in-circuit values

Chain aggregation       ~5,000 constraints/link       ~1.5 ms at 4444 links
  INPUT:  Previous chain proof hash, current block hash
  OUTPUT: commitment (new chain proof)
  USE:    O(1) chain verification

The numbers are approximate constraint counts from the AIR definitions in the codebase. Exact counts vary with the input widths and the specific version of the AIR. The relative magnitudes — signature AIRs are ~100× larger than hash AIRs, chain-link AIRs are ~same order as state proofs — are what drive design choices.

3. STARK: Terminology

"STARK" stands for Scalable Transparent ARgument of Knowledge. It describes a class of proof systems with four properties: transparent (no trusted setup), scalable (verifier sublinear in computation size), argument (computational soundness), and knowledge (extractable witness).

Plonky3's FRI-based prover produces proofs that satisfy all four properties. When this documentation says "Sahyadri uses STARKs," it means:

What "Sahyadri uses STARKs" means precisely:

  1. Proofs are produced via Plonky3's FRI-based prover.
  2. The commitment scheme is FRI (a hash-based PCS).
  3. The Fiat-Shamir transform is applied with Poseidon2.
  4. The proof is transparent — no trusted setup.
  5. The proof is post-quantum — no elliptic curves.
  6. The proof is compositional — recursion is supported.

What it does NOT mean:

  - Sahyadri uses a specific "STARK library" (Plonky3 is the framework,
    FRI is the PCS, and Sahyadri's AIRs are the constraint systems).
  - All STARK proofs are equivalent (Fractal, Winterfell, Plonky3, and
    others differ significantly in field choice, hash choice, and
    recursion strategy).
  - "STARK" implies a specific proof size (STARK proofs range from a
    few KB to hundreds of KB depending on the AIR and parameters).

In this document, "STARK" is used as the generic term when the specific construction does not matter. When it matters, the document says what it actually is: "FRI-based binary-field recursive proof" or "Poseidon2 Merkle commitment" or "Dilithium batch STARK" — each of which is a distinct concrete instantiation.

4. Batch Proving (Block-Level)

A block contains N transactions. Each transaction has an ML-DSA-65 signature. Batch proving produces a single proof attesting to all N signatures at once.

Batch-Prove: (Signature, Message, PubKey)^N → Proof

  Given:  (σ_1, m_1, pk_1), ..., (σ_N, m_N, pk_N)

  Proves: ∀i ∈ [1,N]: Verify_ML-DSA(σ_i, m_i, pk_i) = ⊤

  Measured (Core Ultra 5, 18 threads, release build):

    N = 2:  root proof 631 KB, aggregate 22 s, verify 35 ms
    N = 4:  root proof 710 KB, aggregate 44 s, verify 35 ms
    N = 8:  root proof 735 KB, aggregate 31 s, verify 35 ms

  Growth:
    Size:     sub-linear, asymptotes near ~750 KB
    Verify:   constant (35 ms, independent of N)
    Prove:    linear in N (dominated by signature verification cost)

The signature AIR is the expensive part. Each ML-DSA-65 signature has ~30,000 constraints. The batch proof carries all N signature constraint systems plus a lightweight aggregation circuit. As N grows, the aggregation overhead becomes a smaller fraction, so proof size asymptotes rather than growing linearly.

Verification cost is dominated by FRI proof verification, which is independent of batch size. Verifying a 2-signature batch proof and an 8-signature batch proof both take ~35 ms because the FRI parameters are the same and the number of queries is the same.

5. Chain Aggregation (O(1) Verification)

Chain aggregation takes the previous chain-proof commitment and the current block's batch-proof hash, producing an updated chain-proof commitment. Repeated aggregation links commitments across the chain. Under the current Path B design, this does not constitute recursive verification of every underlying batch proof.

Chain-Prove: (ChainProof, BatchProof) → ChainProof

  π_1 = ChainCommitment(genesis_commitment, block_1_batch_proof_hash)

  π_n = ChainCommitment(
            hash(π_{n-1}),
            hash(block_n_batch_proof)
        )

  Proves:  "π_{n-1} was a valid chain proof
            AND block_n's batch proof hashes to X"

  Measured at 4444 leaves (16-core consumer CPU with AVX2):

    Real-leaf proving (Plonky3 SC+FRI → V2 MultiStark):
      4444 leaves:      45.9 s  (10.3 ms/leaf, ~80 KB/proof serialized)

    Batched proof composition (tree of MultiStark proofs):
      Full tree build:  603 s   (4443 compositions, ~200 KB/proof)
      Chain verify:     1.5 ms  (per aggregated proof, constant in n)

    Full real-recursive E2E:    T1.4c pending (est. ~650 s)

The ~200 KB figure is not the size of a STARK. It is the size of a commitment structure that attests to a STARK. This is why it is 77× smaller than the batch proof's 631-735 KB — the chain proof does not recursively re-prove signature validity, only that a commitment was made correctly.

This distinction matters for security analysis. The batch proof attests that the signatures in a block are valid — full cryptographic soundness. The chain proof attests that a batch proof with a specific hash was committed — tamper-detection soundness. Path A (in-circuit Merkle) would close this gap by recursively proving the batch proof's validity. Path B (public-value binding, current) relies on the batch proof having been verified once at commit time.

6. State Proofs (Account-Level)

State is committed in a Sparse Merkle Tree using Poseidon2 over Goldilocks. Every account occupies a leaf. The root is in every block header. A state proof attests that a specific key-value pair is present (or absent) at the committed root.

State proof structure:

  Proof {
      siblings: Vec<H256>,     // one per level, root-down
      terminal: Terminal,      // Leaf(key, value) or Empty
  }

Verification:

  Reconstruct(key, proof) → H256

    h = HashTerminal(proof.terminal)
    for i = d-1 downto 0:
      h = if bit(key, i) = 0: HashBranch(h, sibling[i])
          else:               HashBranch(sibling[i], h)
    return h

  Accept iff:
    Reconstruct(key, proof) == trusted_root
    ∧ terminal.key == key

Cost:
  O(d) Poseidon2 permutations, d ≤ 256
  <1 ms on any device, ~2 KB typical proof size

The state proof is optionally wrapped in a STARK for light-client use. The wrapped version proves "this Merkle path verifies against this root" inside a Plonky3 circuit, at ~5,000 constraints. The unwrapped version performs the Merkle walk directly, which is faster (~0.1 ms) but requires the client to implement Poseidon2 in the verifier language.

7. Chain Commitment vs Chain Proof

These are two different things, often conflated. The distinction is important for understanding what the protocol actually guarantees.

Chain commitment (per block):

  - 32-byte hash stored in every block header
  - Computed as: hash(parent_commitment ‖ block_proof_hash)
  - Purpose: tamper detection at every block
  - Cost: one hash per block
  - Provides: any change to a past proof invalidates all descendants

Chain proof (per aggregation):
  - ~200 KB object, produced at aggregation checkpoints
  - Links successive chain-proof commitments and batch-proof hashes
  - Current Path B binds public values; it does not recursively verify
    the full validity of each child batch proof
  - Purpose: O(1) verification of the whole chain
  - Cost: 603 s at 4444 blocks (16-core, batched proof composition)
  - Provides: full chain validity in a single object

The commitment runs continuously (every block).
The proof runs periodically (checkpoint aggregates).
Neither replaces the other — they compose.

A node can verify the chain to any depth by checking the commitment chain, at the cost of O(n) hashes. A node with the latest chain proof can verify the entire chain in 1.5 ms (verify time; proof size ~200 KB). The commitment chain is available from block 1; the chain proof becomes available once the aggregation worker produces it.

8. Why Plonky3 and Not Another Framework

The choice is not arbitrary. Plonky3 is the only mature Rust framework that combines all of the following:

Requirement                          Plonky3  Other frameworks

Multiple field backends               Yes      Limited
  (Goldilocks, BabyBear, Mersenne31)
Hash-based commitment (FRI)           Yes      Some (often elliptic)
No trusted setup                      Yes      No (Groth16, PLONK variants)
Post-quantum                          Yes      No (pairing-based systems)
Recursion primitives                  Yes      Some (often expensive)
AIR abstraction                       Yes      Some (R1CS is less flexible)
Rust implementation                   Yes      Varies
Mature test suite                     Yes      Varies
Production deployment in PoW chain    Yes      Rare

The critical requirements for Sahyadri are no-trusted-setup, post-quantum, and efficient recursion. Plonky3 is the framework that provides all three simultaneously. Alternatives like Groth16 have trusted setups; PLONK-based systems are not post-quantum; both are difficult to recursively compose.

9. Path A and Path B

The recursion strategy has a security tier that must be disclosed. The current implementation uses Path B.

Path A (full adversarial soundness):

  Approach: Verify the entire Merkle path in-circuit.
  Effect:   A malicious prover cannot lie about inclusion.
  Cost:     ~19 min (legacy in-circuit Path A). A'2 bus-delegated Merkle: 4-level measured 0.28 s, 4444-level target in progress.
  Status:   Non-viable. Documented as a dead-end in
            proof-aggregation.

Path B (public-value binding, current):

  Approach: Verify only the sumcheck + fold chain in-circuit.
            Merkle verified natively outside the proof, during
            child-proof generation. Commitment binding via
            witness-trace consistency.
  Effect:   Sound against honest-prover attacks. Forgery
            requires breaking Fiat-Shamir.
  Cost:     ~298 ms per composition.
  Status:   Testnet-grade. Implemented and running.

A'2 (delegated Merkle, under research):

  Approach: Split a compact MerkleVerifierAir off the main
            circuit. Batch-verify 8 Merkle paths per proof.
  Target:   ~5-10× constraint reduction.
  Status:   Not started. 2-3 week research spike.

Plonky3 provides the primitives for both paths. It does not choose the path — that is a protocol decision. Path B is what makes 4444-scale aggregation viable today; Path A would close the soundness gap at a cost that current hardware cannot bear.

10. What Plonky3 Does Not Solve

Plonky3 is a framework. It does not solve protocol-level problems. Explicitly not solved by the framework:

Not solved by Plonky3:

  - Chain aggregation strategy
      (N-to-1 binary tree vs linear chain vs batch-STARK tree)

  - Mining-aware proving
      (limiting proof worker CPU to avoid stealing mining hashrate)

  - Proof storage and RPC
      (which proofs to keep, how to serve them, when to prune)

  - P2P propagation
      (how proofs move between peers, what to do on verification failure)

  - Soundness tier
      (Path A vs Path B vs Path A'2 — a protocol choice, not a framework choice)

  - Checkpoint policy
      (how often to produce full chain proofs vs how often to rely on
       chain commitments)

Each of these is decided by Sahyadri, not by Plonky3.

A protocol reviewer must evaluate both the framework and the protocol's use of it. Plonky3 being well-designed does not imply that Sahyadri's composition is sound. Both must be reviewed independently.

11. Complexity

OperationTimeSpaceNotes
Signature batch proof generationO(N) in sig countO(N)Dominated by ML-DSA verification cost
Signature batch proof verifyO(1) in sig countO(1)FRI verify dominates
Chain aggregation stepO(1)O(1)One recursive verifier circuit
Chain proof verifyO(1)O(1)~200 KB, sublinear in tree depth (O(log N))
State proof generationO(depth)O(depth)Poseidon2 walk from root to leaf
State proof verifyO(depth)O(depth)Same, in reverse
Full chain build (4444 blocks, batched)603 s~16 GB peak16-core consumer CPU with AVX2

12. What This Enables

A light client verifies a chain of 4444 blocks in 1.5 ms with a ~350 KB proof. It does not hold the chain, does not trust a node, does not trust a committee. The proof is the authority. This is a property of the composition Sahyadri defines on top of Plonky3 — not of Plonky3 itself.

A bridge to another chain verifies a Sahyadri state transition by checking a single state proof. No multisig, no oracle, no trust committee. The proof is the authority. Again, this is a protocol-level composition, not a framework property.

An exchange credits a deposit only when the batch proof verifies and the chain proof confirms finality. No trust in the node that served the proof. The proof is the authority. The framework provides the primitives; the protocol provides the composition that makes this useful.

13. Summary

Plonky3 is a framework, not a proof system. Sahyadri uses its field, hash, FRI, and recursion primitives to build four proof types: signature batch proofs (~631-735 KB), state proofs (~2 KB), hash proofs (~1 KB), and chain proofs (~200 KB). Each is a custom AIR that Sahyadri defines; none is a Plonky3 out-of-the-box construction.

The chain proof is ~200 KB and verifies in 1.5 ms at any chain length. This is 77× smaller than the batch proof and 77× smaller than Mina's ~22 KB chain proofs. The reduction is not a framework feature — it is a consequence of how Sahyadri chooses to structure chain aggregation: as a commitment chain, not as a recursive signature proof.

The framework provides no opinion on soundness tier, aggregation strategy, mining-aware proving, or checkpoint policy. Those are protocol decisions. The current implementation uses Path B soundness and discloses it. Path A would require 3800× more compute at 4444 scale. That trade-off is documented, not hidden.