zkcrypto / bellman

zk-SNARK library.
Other
988 stars 534 forks source link

Constraint system with arrays/ error in implementing batch mode #67

Closed smithsen closed 3 years ago

smithsen commented 3 years ago

Hey everyone,

I want to make a verification system where I have to test the point wise multiplication of arrays. For instance, [20,20]*[1,0] = [20,0] is what I want to verify. So, what I did was I started with a multiplication circuit and then tried to use batch mode on entire array referring to https://github.com/zkcrypto/bellman/blob/main/benches/batch.rs But, this does not work and gives me an error that bellman::groth16::batch does not exist. Please let me know how will I be able to fix it.

Thanks in advance

daira commented 3 years ago

batch.rs is intended for verifying batches of separate proofs. Since what you want to verify is so simple, it wouldn't make sense to have a separate proof for each element (you would only want to split into multiple circuits if the vectors were absolutely huge). Instead just constrain each multiplication within the circuit just as you would constrain a single multiplication.

str4d commented 3 years ago

Also, we have not yet cut a release of bellman since the batch verification API was merged, so if you're depending on bellman 0.9 that could be your problem. We should be cutting a new release soon (in the next week or so).

str4d commented 3 years ago

The batch API was released in 0.9.0.