08 / 19Module 1: Writing Circom circuitsAdvanced
Circom circuits: compile
Setup Circom circuits
Start with the Circom circuits. You must compile them before you can produce the proving and verification keys.
cd circom_circuitNext, install the dependencies:
npm installCompile Circom circuits
This step compiles every circuit and produces its proving and verification keys.
chmod +x compile_complete.sh Run the compilation:
./compile_complete.shWhen it finishes, you should see these files:
shield_operation.zkey&shield_operation_verification_key.jsonunshield_operation.zkey&unshield_operation_verification_key.jsonprivate_transfer.zkey&verification_key.json
Compilation covers three tasks:
- Translating each readable
.circomsource file into a constraint system (.r1cs). - Running a trusted setup that outputs a proving key (
.zkey) and a verification key (verification_key.json). The client relies on the proving key to create proofs, while the blockchain relies on the verification key to check them. - Building WebAssembly (
.wasm) versions of the circuits so they run efficiently in the browser.
Written for this site from Chromia’s public course. Code samples are the course’s own.