Trait ark_snark::SNARK[][src]

pub trait SNARK<F: PrimeField> {
    type ProvingKey: Clone;
    type VerifyingKey: Clone + ToBytes;
    type Proof: Clone;
    type ProcessedVerifyingKey: Clone;
    type Error: 'static + Error;
    fn circuit_specific_setup<C: ConstraintSynthesizer<F>, R: RngCore + CryptoRng>(
        circuit: C,
        rng: &mut R
    ) -> Result<(Self::ProvingKey, Self::VerifyingKey), Self::Error>;
fn prove<C: ConstraintSynthesizer<F>, R: RngCore + CryptoRng>(
        circuit_pk: &Self::ProvingKey,
        circuit: C,
        rng: &mut R
    ) -> Result<Self::Proof, Self::Error>;
fn process_vk(
        circuit_vk: &Self::VerifyingKey
    ) -> Result<Self::ProcessedVerifyingKey, Self::Error>;
fn verify_with_processed_vk(
        circuit_pvk: &Self::ProcessedVerifyingKey,
        public_input: &[F],
        proof: &Self::Proof
    ) -> Result<bool, Self::Error>; fn verify(
        circuit_vk: &Self::VerifyingKey,
        public_input: &[F],
        proof: &Self::Proof
    ) -> Result<bool, Self::Error> { ... } }

The basic functionality for a SNARK.

Associated Types

type ProvingKey: Clone[src]

The information required by the prover to produce a proof for a specific circuit C.

type VerifyingKey: Clone + ToBytes[src]

The information required by the verifier to check a proof for a specific circuit C.

type Proof: Clone[src]

The proof output by the prover.

type ProcessedVerifyingKey: Clone[src]

This contains the verification key, but preprocessed to enable faster verification.

type Error: 'static + Error[src]

Errors encountered during setup, proving, or verification.

Loading content...

Required methods

fn circuit_specific_setup<C: ConstraintSynthesizer<F>, R: RngCore + CryptoRng>(
    circuit: C,
    rng: &mut R
) -> Result<(Self::ProvingKey, Self::VerifyingKey), Self::Error>
[src]

Takes in a description of a computation (specified in R1CS constraints), and samples proving and verification keys for that circuit.

fn prove<C: ConstraintSynthesizer<F>, R: RngCore + CryptoRng>(
    circuit_pk: &Self::ProvingKey,
    circuit: C,
    rng: &mut R
) -> Result<Self::Proof, Self::Error>
[src]

Generates a proof of satisfaction of the arithmetic circuit C (specified as R1CS constraints).

fn process_vk(
    circuit_vk: &Self::VerifyingKey
) -> Result<Self::ProcessedVerifyingKey, Self::Error>
[src]

Preprocesses circuit_vk to enable faster verification.

fn verify_with_processed_vk(
    circuit_pvk: &Self::ProcessedVerifyingKey,
    public_input: &[F],
    proof: &Self::Proof
) -> Result<bool, Self::Error>
[src]

Checks that proof is a valid proof of the satisfaction of circuit encoded in circuit_pvk, with respect to the public input public_input, specified as R1CS constraints.

Loading content...

Provided methods

fn verify(
    circuit_vk: &Self::VerifyingKey,
    public_input: &[F],
    proof: &Self::Proof
) -> Result<bool, Self::Error>
[src]

Checks that proof is a valid proof of the satisfaction of circuit encoded in circuit_vk, with respect to the public input public_input, specified as R1CS constraints.

Loading content...

Implementors

Loading content...