Trait ark_snark::SNARK

source ·
pub trait SNARK<F: PrimeField> {
    type ProvingKey: Clone + CanonicalSerialize + CanonicalDeserialize;
    type VerifyingKey: Clone + CanonicalSerialize + CanonicalDeserialize;
    type Proof: Clone + CanonicalSerialize + CanonicalDeserialize;
    type ProcessedVerifyingKey: Clone + CanonicalSerialize + CanonicalDeserialize;
    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> { ... } }
Expand description

The basic functionality for a SNARK.

Required Associated Types§

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

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

The proof output by the prover.

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

Errors encountered during setup, proving, or verification.

Required Methods§

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

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

Preprocesses circuit_vk to enable faster verification.

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.

Provided Methods§

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.

Implementors§