Quick Start Guide

Get started with zkkit by building your first zero-knowledge circuit

Overview

This guide walks you through creating your first zero-knowledge proof. You'll write a circuit in Circom, and zkkit will orchestrate circom and snarkjs to compile, prove, and verify it.

πŸ” What you'll learn:

  • β€’ Write a Circom circuit (multiplier example)
  • β€’ Use zkkit to wrap circom compilation
  • β€’ Generate proofs with snarkjs via zkkit commands
  • β€’ Verify proofs cryptographically
1

Initialize Your Project

Start by creating a new zkkit project. This sets up the necessary directory structure and configuration files.

bash
zkkit init my-first-zk-project
bash
cd my-first-zk-project

πŸ“ Project Structure Created:

my-first-zk-project/
β”œβ”€β”€ circuits/          # Your circuit files go here
β”œβ”€β”€ build/            # Compiled circuits output
β”œβ”€β”€ zkkit.config.json # Project configuration
└── package.json      # Node.js dependencies
2

Create Your Circuit

Create a simple multiplier circuit file in the circuits/ directory.

Create circuits/multiplier.circom:

pragma circom 2.0.0;

// This circuit proves that you know two numbers (a, b)
// that multiply to give c, without revealing a or b

template Multiplier() {
    // Private inputs (secret)
    signal input a;
    signal input b;
    
    // Public output
    signal output c;
    
    // Constraint: c must equal a * b
    c <== a * b;
}

component main = Multiplier();

πŸ’‘ What's happening here?

The circuit defines private inputs (a, b) that remain secret, and a public output (c). Anyone can verify that you know values of a and b that multiply to c, without ever seeing a or b!

3

Compile the Circuit

Compile your circuit into the R1CS constraint system and WASM witness generator.

bash
zkkit compile circuits/multiplier.circom

βœ… Files Generated:

  • build/multiplier.r1cs - Constraint system
  • build/multiplier.wasm - Witness generator
  • build/multiplier.sym - Symbol information
4

Prepare Input Data

Create an input file with your secret values. Let's prove we know that 3 Γ— 11 = 33.

Create input.json:

{
  "a": "3",
  "b": "11"
}

πŸ”’ Privacy Note:

The values "3" and "11" are our private inputs. They will never be revealed in the proofβ€”only the fact that we know numbers that multiply to 33.

5

Generate Witness

Compute the witness by executing the circuit with your input values.

bash
zkkit witness multiplier input.json

βœ… Generated:

witness.wtns - Contains all intermediate wire values

6

Run Trusted Setup

Perform the trusted setup ceremony to generate proving and verification keys. We'll use Groth16 for this example.

bash
zkkit setup:groth multiplier

βœ… Keys Generated:

  • circuit_final.zkey - Proving key (used to create proofs)
  • verification_key.json - Verification key (used to verify proofs)

⚑ One-Time Setup:

You only need to run the trusted setup once per circuit. The verification key can be shared publicly and reused for all proofs of this circuit.

7

Generate the Proof

Create a zero-knowledge proof using the witness and proving key.

bash
zkkit proof multiplier

βœ… Proof Created:

  • proof.json - The zero-knowledge proof
  • public.json - Public signals (output: 33)

πŸŽ‰ Success!

You now have a cryptographic proof that you know two numbers that multiply to 33, without revealing what those numbers are!

8

Verify the Proof

Verify that the proof is valid using the verification key and public signals.

bash
zkkit verify multiplier

Expected Output:

βœ“ Proof is valid - Verification successful

πŸ” What Just Happened?

The verifier confirmed that your proof is mathematically validβ€”you DO know numbers that multiply to 33β€”without ever learning that those numbers are 3 and 11!

Complete Command Summary

Here's the entire workflow in one place:

# 1. Initialize project
zkkit init my-first-zk-project
cd my-first-zk-project

# 2. Create circuit (circuits/multiplier.circom)
# [Create the circuit file as shown above]

# 3. Compile circuit
zkkit compile circuits/multiplier.circom

# 4. Create input file (input.json)
# [Create the input file as shown above]

# 5. Generate witness
zkkit witness multiplier input.json

# 6. Run trusted setup
zkkit setup:groth multiplier

# 7. Generate proof
zkkit proof multiplier

# 8. Verify proof
zkkit verify multiplier

Next Steps

Now that you've completed your first zero-knowledge proof, you can:

πŸ“– Explore Commands

Learn more about each zkkit command and its options

πŸ”§ Try Different Circuits

Experiment with more complex circuits like hash functions or Merkle trees

⚑ Optimize Performance

Learn about circuit optimization techniques for faster proofs

πŸš€ Deploy to Production

Integrate zkkit proofs into your blockchain or web applications

Troubleshooting

  • Command not found?

    Make sure zkkit is installed globally: npm install -g zkkit

  • Compilation errors?

    Verify that Rust and Circom are properly installed and in your PATH

  • Proof generation fails?

    Ensure the witness file was generated successfully before creating the proof