Trait ark_crypto_primitives::SNARK[][src]

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

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

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

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

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

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

Preprocesses circuit_vk to enable faster verification.

pub 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

pub 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...