Installation

How do I put Circom on my computer?

If you just want to play with basic circuits, you may find zkrepl.dev to be a lightweight option. Otherwise, you will need to install rust to build and install the Circom binary on your machine. This is the only time you will have to use Rust.

Install the Circom Binary

Quoted from the Circom docs

Installing dependencies

You need several dependencies in your system to run circom and its associated tools.

  • The core tool is the circom compiler which is written in Rust. To have Rust available in your system, you can install rustup. If you’re using Linux or macOS, open a terminal and enter the following command:

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
  • We also distribute a series of npm packages so Node.js and some package manager like npm or yarn should be available in your system. Recent versions of Node.js include big integer support and web assembly compilers that help run code faster, so to get a better performance, install version 10 or higher.

Installing circom

To install from our sources, clone the circom repository:

git clone https://github.com/iden3/circom.git

Enter the circom directory and use the cargo build to compile:

cargo build --release

The installation takes around 3 minutes to be completed. When the command successfully finishes, it generates the circom binary in the directory target/release. You can install this binary as follows:

cargo install --path circom

The previous command will install the circom binary in the directory $HOME/.cargo/bin.

Now, you should be able to see all the options of the executable by using the help flag . .

.

Installing SnarkJS for Development

The officially recommended installation for SnarkJS is use npm or yarn to install the package globally. This enables SnarkJS from the command line.

npm i -g snarkjs
snarkjs
// should show help output if installed correctly
snarkjs g16... // how commands are formed in bash

For the purpose of version control, we hold the opinion that it is better to install SnarkJS at the application level rather than globally. We will use this convention throughout awesome-circom.

yarn add snarkjs
yarn snarkjs
// should show help output if installed correctly
yarn snarkjs g16... // how commands are formed in bash 

See the SnarkJS section for more information on the usage of SnarkJS, including production installation.

pageSnarkJS

Last updated