Compile Circuit - Beginner

This option is for novice users.

Ideal for beginners who want a working zk-SNARK pipeline without diving into each step manually.

This command sets up everything required to generate zk-SNARK proofs for a given circuit, automating the multi-step trusted setup process. Just type the below command, press enter and let the magic unfold!

py poseidon.py --init-setup circuit_name

πŸ”§ What it does:

  1. Compiles the specified Circom file (<circuit_name>)

    • Produces .r1cs, .wasm, and .sym files

  2. Runs Trusted Setup (Powers of Tau + Phase 2)

    • Initializes a new ceremony if none exists

    • Contributes randomness

    • Prepares final .zkey proving key

  3. Generates Keys:

    • proving_key.zkey – for generating zk-proofs

    • verification_key.json – for verifying proofs

  4. Ready for Proofs: After this, you're ready to run --prove and --verify.


Expected Folder Layout

If everything went well your folder structure should look something similar to this,

circuit1.circom is the default example. If you used a different name, that name will appear instead wherever circuit1.circom is shown.

poseidon/
│── circom
│── circomlib/                # Standard library for Circom components
│── circuit1_js
    └── circuit1.wasm         # WebAssembly file used to compute the witness
    └── generate_witness.js
    └── witness_calculator.js
│── circuits/                 # Where your .circom files go
β”‚   └── circuit1.circom       # A starter circuit with boilerplate
│── circuit1_000.zkey         # Final proving key used for generating zk-SNARK proofs
│── circuit1_final.zkey       
│── circuit1.r1cs
│── circuit1.sym              # Symbol file used for debugging constraint errors
│── pot10_0000.tau
│── pot10_0001.tau
│── pot10_final.tau           # Finalized Powers of Tau file used in Phase 2
│── requirements.txt
│── poseidon.py             

Last updated