Trait VectorCommitment

Source
pub trait VectorCommitment {
    type UniversalParams: VCUniversalParams;
    type PreparedData: VCPreparedData;
    type Commitment: PartialEq + Clone;
    type Proof;
    type BatchProof;
    type Error: Error + Debug;

    // Required methods
    fn setup<R: RngCore>(
        max_items: usize,
        rng: &mut R,
    ) -> Result<Self::UniversalParams, Self::Error>;
    fn commit(
        key: &Self::UniversalParams,
        data: &Self::PreparedData,
    ) -> Result<Self::Commitment, Self::Error>;
    fn prove(
        key: &Self::UniversalParams,
        commitment: &Self::Commitment,
        index: usize,
        data: &Self::PreparedData,
    ) -> Result<Self::Proof, Self::Error>;
    fn prove_all(
        key: &Self::UniversalParams,
        commitment: &Self::Commitment,
        data: &Self::PreparedData,
    ) -> Result<Self::BatchProof, Self::Error>;
    fn verify(
        key: &Self::UniversalParams,
        commitment: &Self::Commitment,
        proof: &Self::Proof,
    ) -> Result<bool, Self::Error>;
    fn verify_batch(
        key: &Self::UniversalParams,
        commitment: &Self::Commitment,
        proof: &Self::BatchProof,
    ) -> Result<bool, Self::Error>;
    fn convert_commitment_to_data(
        commit: &Self::Commitment,
    ) -> <Self::PreparedData as VCPreparedData>::Item;
}
Expand description

A vector commitment schemes allows committing to a vector of data and generating proofs of inclusion.

Required Associated Types§

Source

type UniversalParams: VCUniversalParams

The universal parameters for the vector commitment scheme. CURRENTLY this API does not support differing committing, proving and verifying keys

Source

type PreparedData: VCPreparedData

The vector dataset that has gone through preparation to use with the Vector Commitment.

Source

type Commitment: PartialEq + Clone

The Commitment to a vector.

Source

type Proof

The proof for a single member of a vector.

Source

type BatchProof

The proof for multiple members of a vector.

Source

type Error: Error + Debug

The error type for the scheme.

Required Methods§

Source

fn setup<R: RngCore>( max_items: usize, rng: &mut R, ) -> Result<Self::UniversalParams, Self::Error>

Constructs the Universal parameters for the scheme, which allows committing and proving inclusion of vectors up to max_items items

Source

fn commit( key: &Self::UniversalParams, data: &Self::PreparedData, ) -> Result<Self::Commitment, Self::Error>

Commit a prepared data vector (data) to the key UniversalParams.

Source

fn prove( key: &Self::UniversalParams, commitment: &Self::Commitment, index: usize, data: &Self::PreparedData, ) -> Result<Self::Proof, Self::Error>

Prove that a piece of data exists inside of commitment. The index represents the index of the data inside of data.

Source

fn prove_all( key: &Self::UniversalParams, commitment: &Self::Commitment, data: &Self::PreparedData, ) -> Result<Self::BatchProof, Self::Error>

Generate all proofs of the dataset using the Feist-Khovratovich techique

Source

fn verify( key: &Self::UniversalParams, commitment: &Self::Commitment, proof: &Self::Proof, ) -> Result<bool, Self::Error>

Verify that the proof is valid with respect to the key and commitment

Source

fn verify_batch( key: &Self::UniversalParams, commitment: &Self::Commitment, proof: &Self::BatchProof, ) -> Result<bool, Self::Error>

Verify multiple proofs are valid TODO: Keep this as boolean return value, or number of valid proofs? Once compression is implemeneted then will be boolean

Source

fn convert_commitment_to_data( commit: &Self::Commitment, ) -> <Self::PreparedData as VCPreparedData>::Item

Converts a commitment to PreparedData::Item

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§