Welcome to Circom Boilerplate, your go-to toolkit for simplifying the development process with Circom. This boilerplate comes loaded with scripts, ensuring a hassle-free experience in setting up your environment, installing dependencies, and automating the entire development workflow.
- Node.js: Installed (Version 10 or higher)
Tip: Don't have Node.js installed? No worries! You can easily try out this boilerplate using GitHub Codespaces. Simply click the green
<> Code
button on the repository page, selectCodespaces
, and hit the+
button. Voilà! You'll have an online development environment tailored to this project.
- Clone the Repository:
git clone https://github.com/KumaCrypto/circom_boilerplate.git
or via SSH
git clone [email protected]:KumaCrypto/circom_boilerplate.git
- Navigate to the Project Directory:
cd circom_boilerplate
- Install Dependencies:
If you haven't installed Rust
yet:
npm run install_rust
Note: During the process you will be asked to select an installation method, select option 1 (unless you require a different one). After the installation, close the current terminal and open a new one to continue.
Install Circom and SnarkJS:
npm run setup
Tip: For comfortable writing of circuits you can install the Circom code highlighting extension. (More visually appealing than black and white text).
This boilerplate offers the following scripts:
Depending on your circuit, fill in the input.json file.
This script handles everything – from compiling your circuit to verifying it with a generated witness. Important: This contributes to PowersOfTau (POT) and prepares for the second phase (this might take a while).
Conditions:
- The circuit must be in the
circuits
folder. - The file containing arguments for the circuit must be named
input.json
and placed at the root of the repository.
npm run test <circuit name> # Default input: input.json (change it in package.json if needed)
The output will be generated in the build
directory.
Similar to the previous command, but skips the contribution to POT and second stage preparation. Faster. Use it for quick circuit tests or if you understand what you're doing.
Can be used if you already have POTs.
npm run test_no_pots <circuit name> # Default input: input.json (change it in package.json if needed)
This command creates a Solidity
contract to verify your circuit on-chain. Make sure to run one of the previous commands to generate the proving key (located at build/circuit_name.zkey
).
npm run solidityVerifier <circuit name>
The verifying contract will be generated in the src
directory.
If you find this boilerplate helpful, show your support by starring it on GitHub. It costs nothing for you but means the world to us. Happy coding! ✨
- Report Bugs: If you encounter a bug, please open a detailed issue on GitHub, explaining how to replicate the problem.
- Suggest Enhancements: Have ideas to enhance this project? Feel free to propose new features or improvements by opening an issue. Your input is invaluable!
This project is licensed under the MIT License - check out the LICENSE file for more details.