NPM package link : https://www.npmjs.com/package/create-circom-project

Circom is a programming language and a toolchain for building and verifying zero-knowledge proofs (ZKPs).
This command npx create-circom-project will create a new project with help you get started with a circom project in a min, with all the toolchain support pre-made. Also a bunch of useful scripts are provided to help you get started with your project. These are in form of npm run commands.

Commands available :-

  • npm run build - This will compile and build the r1cs and wasm files from the circom circuits.
  • npm run setup - This will executed the trusted setup needed with the help of the powersOfTau file in the project root, and generate the keys for the prover and verifier.
  • npm run inspect - This will inspect the circuit and print the circuit details. This uses circomspect to inspect the circuit.
  • npm run generate-verifier - This will generate the solidity verifier contract for the circom circuit.
  • npm run clean - This will clean the existing build folder and the other generated files.
  • npm run verify - This will run the scripts/main.js files, which will verify the proof generated by the prover. This is a sample script to help you get started with your project.

The project structure is as follows :-

├── README.md
├── circuits
│   ├── build
│   │   ├── circuit.r1cs
│   │   ├── circuit_js
│   │   │   ├── circuit.wasm
│   │   │   ├── generate_witness.js
│   │   │   └── witness_calculator.js
│   │   └── keys
│   │       ├── circuit_0000.zkey
│   │       └── verification_key.json
│   └── circuit.circom
├── contracts
│   └── Verifier.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
├── powersOfTau28_hez_final_12.ptau
└── scripts
    ├── main.js
    └── utils
        ├── generateProof.js
        └── verify.js

The circuits files or .circom files are in the circom/ folder. The generated and other custom contracts are in the folder contracts/. The circom/build/ folder contains all the generated files from a circom circuit. Inside the folder circom/build/keys/ there will stay the keys generated for prover and the verifier. </br> The project comes with native support of hardhat so you can compile your circuits with npx hardhat compile. All the other available hardhat commands are also available. The hardhat.config.js file is already configured to work with circom.

Install the dependencies for this command

  • Install rust
    curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
    
  • Install circom
    git clone https://github.com/iden3/circom.git
    cd circom
    cargo build --release
    cargo install --path circom