Getting Started


Remix online IDE

To write your first SNARK program, check out the ZoKrates plugin in the Remix online IDE!

One-line installation

We provide one-line installation for Linux, MacOS and FreeBSD:

curl -LSfs | sh


ZoKrates is available on Dockerhub.

docker run -ti zokrates/zokrates /bin/bash

From there on, you can use the zokrates CLI.

From source

You can build ZoKrates from source with the following commands:

git clone
cd ZoKrates
cargo +nightly build --release
cd target/release

Hello ZoKrates!

First, create the text-file root.zok and implement your program. In this example, we will prove knowledge of the square root a of a number b:

def main(private field a, field b) -> bool:
  return a * a == b

Some observations:

  • The keyword field is the basic type we use, which is an element of a given prime field.
  • The keyword private signals that we do not want to reveal this input, but still prove that we know its value.

Then run the different phases of the protocol:

# compile
zokrates compile -i root.zok
# perform the setup phase
zokrates setup
# execute the program
zokrates compute-witness -a 337 113569
# generate a proof of computation
zokrates generate-proof
# export a solidity verifier
zokrates export-verifier

The CLI commands are explained in more detail in the CLI reference.