kaleido-io / kaleido-iden3-samples

Sample code for using the iden3 protocol to issue verifiable claims
Apache License 2.0
6 stars 4 forks source link

Iden3/snarkJS questions #17

Open jcqjamesbond opened 1 year ago

jcqjamesbond commented 1 year ago

Hi Kaleido-iden3 team members: we have several questions when executing the demo in https://github.com/iden3/snarkjs

  1. Should the entropy and the hashes be kept during the ceremony contribution part? What are these hashes meaning (contribution response hash/ next challenge hashes)?
  2. What's the purpose of applying random beacon?
  3. In kaleido-iden3 repo, how is the circuit_final.zkey file generated? which role is responsible for the generation of circuit_final.zkey file?
  4. How does the witness.wtns generated based on circom by the prover?
  5. How would verifier believe according to the public.json and proof.json generated by prover?
OBrezhniev commented 1 year ago

Hi @jcqjamesbond

These blog posts can give you some understanding of trusted setup ceremonies: https://blog.hermez.io/hermez-zero-knowledge-proofs/ https://blog.hermez.io/hermez-trusted-setup-phase-2/ https://blog.hermez.io/finishing-hermez-trusted-setup-ceremony/

You don't need to do these ceremonies. First phase (Perpetual Powers of Tau) is universal for all circuits. We are using ptau files generated for Hermez. Second phase is circuit specific, and needs to be run each time circuit changes. You can see details of this setup phase for our current circuits here: https://github.com/iden3/phase2ceremony

For the next release of Polygon ID & iden3 protocol we at iden3 will do this ceremony again, because there will be changes to the circuits. Anyone can participate, so if you are interested, you can leave you contact details and we will contact you to do a contribution. The more contributions done - the better, because as long as at least one participant is honest and destroys the toxic values, the whole system stays secure.

Witness file is generated from public and private inputs of the circuit by a special program called witness calculator (which is generated by circom for each specific circuit). In case of a mobile wallet, witness and proof (based on this witness and using proving key - zkey) is generated on the mobile. Then proof together with public inputs is given to the verifier, which can verify their correctness using a verification key. All of these trusted setup artifacts are public, in the repo I mentioned.