Skip to content

Generic scripts to create zero knowledge applications using circom and snarkjs

License

Notifications You must be signed in to change notification settings

vplasencia/circom-snarkjs-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Generic scripts using circom and snarkjs

To learn more about circom: https://github.com/iden3/circom

To learn more about snarkjs: https://github.com/iden3/snarkjs

The circom compiler version used is: 2.0.3.

The snarkjs version used is: 0.6.1.

Note: All the scripts are inside the scripts folder.

To organize all the scripts you can create a scripts folder next to the circuit and input file you want to work with, and add all the scripts like this:

├── scripts
│   ├── compile.sh
│   ├── executeFflonk.sh
│   ├── executeGroth16.sh
│   ├── executePlonk.sh
│   ├── generateWitness.sh
│   ├── removeBuildFolder.sh
├── circuit.circom
├── input.json

When you wan to run a script, for each script:

Run the first time:

chmod u+x ./scripts/<scriptName>.sh

And after that, you can always run:

./scripts/<scriptName>.sh

When you run one of the circom or circom-snarkjs scripts, a build folder will be created with all the generated files inside. You can delete the build folder by running the removeBuildFolder.sh file.

./scripts/removeBuildFolder.sh

Note: It is not necessary to run the removeBuildFolder.sh script every time you want to run a new script, because every time you run a script, the build folder is automatically removed if it exists.

circom scripts

  • compile.sh

To compile circom circuits, you can run the compile.sh file.

./scripts/compile.sh
  • generateWitness.sh

To generate the witness, you can run generateWitness.sh

./scripts/generateWitness.sh

When you run a circom script you will see something like this:

├── build
│   ├── ...
├── scripts
│   ├── ...
├── circuit.circom
├── input.json

circom-snarkjs scripts

  • executeGroth16.sh

To generate all the necessary files for a zero knowledge application using Groth16 run executeGroth16.sh.

./scripts/executeGroth16.sh
  • executePlonk.sh

To generate all the necessary files for a zero knowledge application using Plonk run executePlonk.sh.

./scripts/executePlonk.sh
  • executeFflonk.sh

To generate all the necessary files for a zero knowledge application using Fflonk run executeFflonk.sh.

./scripts/executeFflonk.sh

When you run a circom-snarkjs script, you will see something like this:

├── build
│   ├── ...
├── ptau
│   ├── ...
├── scripts
│   ├── ...
├── circuit.circom
├── input.json

Note: The ptau folder is generated with the necessary ptau file, but you can have this folder with the ptau that you will use, and it will not be generated again.

You can see different ptau files in the snarkjs documentation.

About

Generic scripts to create zero knowledge applications using circom and snarkjs

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages