zkkit
v0.1.0
Published
A comprehensive toolkit for building zero-knowledge proofs using Groth16 and snarkjs
Maintainers
Readme
zkkit 🔐
A comprehensive command-line toolkit for building, testing, and deploying zero-knowledge proofs using the Groth16 proving system. zkkit streamlines the entire workflow from circuit compilation to proof generation and verification.
Overview
zkkit abstracts the complexity of zero-knowledge proof development by providing a clean, intuitive API and CLI interface. Whether you're building privacy-preserving applications, credentials systems, or cryptographic protocols, zkkit handles the heavy lifting of zk-SNARK operations.
Key Features
- 🚀 Simple CLI & Programmatic API - Use as command-line tool or import functions in your code
- 🔧 Complete Workflow - From circuit compilation to proof verification
- 🛡️ Secure Setup - Built-in trusted setup ceremony with entropy support
- ⚡ Efficient - Leverages snarkjs and circom for optimal performance
- 📦 Zero Dependencies Hell - Minimal, well-maintained dependencies
- 🔌 Composable - Mix and match functions for custom workflows
Installation
Prerequisites (Required)
Before installing zkkit, you must have the following installed on your system:
1. Node.js (v14 or higher)
Required for running zkkit and npm packages.
macOS:
brew install nodeUbuntu/Debian:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejsVerify installation:
node --version
npm --version2. Rust (Latest stable)
Required for circom compilation and cryptographic operations.
macOS & Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/envVerify installation:
rustc --version
cargo --version3. Circom (v2.0 or higher)
The circuit compiler for zero-knowledge proofs.
macOS:
brew install circomLinux (from source):
git clone https://github.com/iden3/circom.git
cd circom
cargo build --release
sudo cp target/release/circom /usr/local/bin/Verify installation:
circom --version4. snarkjs (Global installation recommended)
The SNARK toolkit for proof generation and verification.
npm install -g snarkjsVerify installation:
snarkjs --versionVia npm
Once all prerequisites are installed:
npm install zkkitVia npm link (Development)
git clone <repository-url>
cd zkkit
npm install
npm linkThen in your project:
npm link zkkitQuick Start
Using the CLI
# Initialize a new zkSNARK project
zkkit init
# Compile your circuit
zkkit compile --circuit circuits/schema.circom --out outputs
# Generate witness
zkkit witness --input inputs/inputs.json --name witness.wtns
# Perform trusted setup
zkkit setup:trusted "your-entropy-string"
# Setup Groth16 proving system
zkkit setup:groth
# Generate proof
zkkit proof
# Verify proof
zkkit verifyCLI Commands in Action:


Using Programmatically
const {
init,
compileCircuit,
generateWitness,
generateTrustedSetup,
generateGrothSetup,
generateProof,
verify
} = require("zkkit");
async function main() {
// Initialize project structure
await init();
// Compile Circom circuit
await compileCircuit({
circuit: "circuits/schema.circom",
out: "outputs"
});
// Generate witness from inputs
await generateWitness({
input: "inputs/inputs.json",
name: "witness.wtns"
});
// Perform trusted setup (Powers of Tau)
await generateTrustedSetup("your-entropy-string");
// Setup Groth16 proving system
await generateGrothSetup();
// Generate zero-knowledge proof
await generateProof();
// Verify the proof
await verify();
console.log("✅ Proof generated and verified successfully!");
}
main().catch(console.error);Successful Workflow Execution:

The above screenshot shows a complete successful run of the entire zero-knowledge proof workflow, from circuit compilation through proof verification.
API Reference
init()
Initializes a new zkSNARK project with the required directory structure.
Creates:
circuits/- Directory for Circom circuit filesinputs/- Directory for input JSON filesoutputs/- Directory for compiled outputs
Example:
await init();compileCircuit(options)
Compiles a Circom circuit to R1CS and WebAssembly formats.
Parameters:
options.circuit(string) - Path to the.circomfileoptions.out(string) - Output directory for compiled files
Output Files:
{out}/schema.r1cs- R1CS constraint system{out}/schema_js/schema.wasm- WebAssembly binary{out}/schema_js/generate_witness.js- Witness generator
Example:
await compileCircuit({
circuit: "circuits/schema.circom",
out: "outputs"
});generateWitness(options)
Generates a witness from circuit inputs.
Parameters:
options.input(string) - Path to input JSON fileoptions.name(string) - Name of the output witness file
Input JSON Format:
{
"a": 3,
"b": 11
}Example:
await generateWitness({
input: "inputs/inputs.json",
name: "witness.wtns"
});generateTrustedSetup(entropy)
Performs the Powers of Tau ceremony - the first phase of the trusted setup. This generates the public parameters needed for the proving system.
⚠️ Important: The entropy parameter is crucial for security. It should be a high-entropy string that you keep secret.
Parameters:
entropy(string) - Random entropy string for the ceremony
Generated Files:
pot12_0000.ptau→pot12_0001.ptau- Powers of Tau intermediatepot12_final.ptau- Final Powers of Tau parameters
Example:
await generateTrustedSetup("super-secure-entropy-string-12345");generateGrothSetup()
Performs the Phase 2 setup specific to your circuit. Creates the proving and verification keys for the Groth16 protocol.
Prerequisites:
- Circuit must be compiled (R1CS file exists)
- Trusted setup must be completed (pot12_final.ptau exists)
Generated Files:
circuit_0000.zkey- Proving keyverification_key.json- Verification key
Example:
await generateGrothSetup();generateProof()
Generates a zero-knowledge proof using the witness and proving key.
Prerequisites:
- Witness generated
- Groth16 setup completed
Generated Files:
proof.json- The zero-knowledge proofpublic.json- Public inputs/outputs
Example:
await generateProof();verify()
Verifies a proof using the verification key.
Prerequisites:
- Proof generated
- Verification key exists
Returns: Console output indicating success or failure
Example:
await verify();Project Structure
your-project/
├── circuits/
│ └── schema.circom # Your circuit definitions
├── inputs/
│ └── inputs.json # Circuit input values
├── outputs/
│ ├── schema.r1cs # Compiled R1CS
│ └── schema_js/
│ ├── schema.wasm # WebAssembly binary
│ └── generate_witness.js
├── proof.json # Generated proof
├── public.json # Public outputs
├── verification_key.json # Verification key
├── circuit_0000.zkey # Proving key
├── pot12_final.ptau # Powers of Tau
└── main.js # Your scriptUnderstanding the Workflow
1. Circuit Definition 📝
You write constraints in Circom language defining what you want to prove.
2. Compilation 🔨
The circuit is compiled to R1CS (Rank-1 Constraint System) and WebAssembly.
3. Trusted Setup 🔐
Powers of Tau ceremony generates common parameters. This is a one-time setup per circuit.
4. Groth16 Setup 🛠️
Creates proving and verification keys specific to your circuit.
5. Witness Generation 📊
Evaluates the circuit with your private inputs to generate a witness.
6. Proof Generation ⚡
Uses the witness and proving key to create a succinct proof.
7. Verification ✅
Anyone can verify the proof using only public inputs and the verification key.
Common Use Cases
- Privacy-Preserving Authentication - Prove identity without revealing sensitive data
- Credentials - Issue and verify credentials without shared databases
- Confidential Transactions - Prove transaction validity privately
- Scalability Solutions - Bundle multiple transactions into one proof
- Compliance - Prove regulatory compliance without exposing details
Requirements
⚠️ IMPORTANT: All of these must be installed and working before using zkkit:
- Node.js >= 14.0.0
- Rust - Latest stable version
- circom >= 2.0 - Circuit compiler
- snarkjs >= 0.4.0 - SNARK toolkit
See Installation Prerequisites section above for detailed installation instructions for each dependency.
If any of these are missing, zkkit will not work. Please complete the prerequisite installation before proceeding.
Environment Setup
See the Prerequisites (Required) section above for complete setup instructions for macOS and Linux.
Tips & Best Practices
Security
- Entropy - Use cryptographically secure entropy for trusted setup
- Key Management - Keep your proving keys (
circuit_0000.zkey) private - Verification - Always verify proofs before trusting computations
- Audits - Have trusted setup audited before production use
Performance
- Circuit Optimization - Keep circuits simple to reduce proving time
- Batch Operations - Generate multiple proofs in parallel
- Incremental Setup - Reuse Powers of Tau across multiple circuits
Development
- Start Small - Begin with simple circuits to understand the workflow
- Test Locally - Run full workflow locally before production
- Version Control - Track your circuits and inputs in git
- Documentation - Document your circuit logic and assumptions
Troubleshooting
"Cannot find package zkkit"
# Ensure npm link is set up correctly
npm link zkkit
# Or reinstall
npm install zkkit"Command failed: circom"
# Verify circom is installed
circom --version
# If not, install it
brew install circom # macOS"Proof verification failed"
- Check that
proof.jsonandpublic.jsonwere generated correctly - Verify the verification key matches the circuit
- Ensure witness was generated with correct inputs
"ReferenceError: require is not defined"
- Ensure your
package.jsondoes NOT have"type": "module" - Or use ES6 import syntax throughout your project
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
License
ISC - See LICENSE file for details
Resources
- Circom Documentation - https://docs.circom.io/
- snarkjs - https://github.com/iden3/snarkjs
- Zero-Knowledge Proofs - https://zkp.science/
- Groth16 Protocol - https://eprint.iacr.org/2016/260.pdf
Support
For issues and questions:
- Open an issue on GitHub
- Check existing documentation
- Review circuit examples
Happy Proving! 🚀
Built with ❤️ for the zero-knowledge community.
