doutv / aptos-keyless-circuit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aptos Keyless circuit

Installing dependencies

The scripts in this repository will not work without installing the dependencies.

To install, please run:

./install-deps.sh

Generating the proving key

To generate a sample prover and verifier key pair, run the following commands:

./trusted-setup.sh --local tmp
# ./trusted-setup.sh main sample_keypair

Generating a sample proof

./create-proofs-for-testing.sh --local ./tmp/prover_key.zkey ./tmp

To generate a sample proof for the statement encoded in input-gen.py, do the following. First, make sure you have a proving key set up (see above).

Second, call the following script, where:

  • <keyless-circuit-branch> is the branch of the keyless-circuit repo that contains the version of the circuit you want to use
  • <proving_key_path> is the path to the proving key.
  • <output_dir> is an optional output directory where the proof.json and public.json files will be created.
 ./create-proofs-for-testing.sh <keyless-circuit-branch> <proving_key_path> [<output_dir>]

For example, the command could be:

 ./create-proofs-for-testing.sh main ../aptos-keyless-trusted-setup-contributions/contributions/main_final.zkey

(Note: Here, we are assuming the main_final.zkey proving key is in the aptos-keyless-trusted-setup-contributions repo, stored in the parent directory.)

This command will create two files in the current working directory:

  1. An input.json file containing the inputs to the circuit that are to be proved
  2. A proof.json file containing the actual proof.
  3. A public.json file containing the public inputs under which the proof verifies

Circuit stats

Command:

circom -l . main.circom --r1cs

Output:

non-linear constraints: 1312453
linear constraints: 0
public inputs: 1
private inputs: 7123 (7033 belong to witness)
public outputs: 0
wires: 1282587
labels: 6162830

About

License:Apache License 2.0


Languages

Language:Circom 73.3%Language:Python 20.8%Language:Shell 5.9%