a16z / cicada

A protocol for private on-chain voting, implemented in Solidity.
GNU Affero General Public License v3.0
310 stars 23 forks source link

Gas-golfing possibilities #3

Open seresistvanandras opened 1 year ago

seresistvanandras commented 1 year ago

Hi! Congrats! Nice work! Here are a few initial ideas for gas-golfing. Hope you'll find them useful.

  1. Modular multiplication
  1. Conjunctive normal form (CNF) of Sigma-protocols When proving the correctness of the cast ballot, the prover needs to show that the exponential ElGamal encrypts to either 0 or 1, i.e., ($u=g^r \land v=h^r)\lor(u=g^r \land v\cdot y^{-1}=h^r)$. This composition of the Chaum-Pedersen proof and the OR-proof consists of 8 group elements and the verifier's work is 5 modular multiplication. Using the distributive law, would not it be more efficient to rather prove $u=g^r\land(v=h^r\lor v\cdot y^{-1}=h^r)$? This paper suggests a more efficient Sigma-protocol composition for CNF of Sigma protocols for DLOG relations than the original Cramer, Damgård, and Schoenmakers (CRYPTO'94) paper. Here is a link to the paper.
moodlezoup commented 1 year ago

These are really good ideas! I will do some experimenting (or if anyone else wants to tackle one, let me know). Thank you for the suggestions!