SigmaProtocol

Trait SigmaProtocol 

Source
pub trait SigmaProtocol {
    type Statement: Clone + Send + Sync;
    type Witness: Clone + Send + Sync;
    type Commitment: Commitment;
    type Challenge: Challenge;
    type Response: Response;

    // Required methods
    fn prover_commit(
        statement: &Self::Statement,
        witness: &Self::Witness,
    ) -> (Self::Commitment, Vec<u8>);
    fn prover_response(
        statement: &Self::Statement,
        witness: &Self::Witness,
        state: &[u8],
        challenge: &Self::Challenge,
    ) -> Result<Self::Response>;
    fn verifier(
        statement: &Self::Statement,
        commitment: &Self::Commitment,
        challenge: &Self::Challenge,
        response: &Self::Response,
    ) -> Result<()>;
}
Expand description

Core trait for SIGMA protocols.

A SIGMA protocol is a three-round interactive proof system with:

  1. Commitment: Prover sends initial commitment
  2. Challenge: Verifier sends random challenge
  3. Response: Prover responds to challenge

Required Associated Types§

Source

type Statement: Clone + Send + Sync

The public statement to be proven.

Source

type Witness: Clone + Send + Sync

The private witness known only to the prover.

Source

type Commitment: Commitment

The commitment message type.

Source

type Challenge: Challenge

The challenge message type.

Source

type Response: Response

The response message type.

Required Methods§

Source

fn prover_commit( statement: &Self::Statement, witness: &Self::Witness, ) -> (Self::Commitment, Vec<u8>)

Generate the prover’s initial commitment.

Returns the commitment and internal state for later use.

Source

fn prover_response( statement: &Self::Statement, witness: &Self::Witness, state: &[u8], challenge: &Self::Challenge, ) -> Result<Self::Response>

Generate the prover’s response to a challenge.

Uses the internal state from commitment phase.

Source

fn verifier( statement: &Self::Statement, commitment: &Self::Commitment, challenge: &Self::Challenge, response: &Self::Response, ) -> Result<()>

Verify a proof transcript.

Returns Ok(()) if the proof is valid, Err otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§