Installation

This section explains how to install the ZKAP development environment, including the SDK, core libraries, and tooling required to build encrypted frames, generate proofs, and interact with the ZKAP Validator.

ZKAP is designed to integrate easily with existing blockchain applications. You do not need a new blockchain, VM, or specialized infrastructure — the SDK works directly in Node.js or any agent runtime.


1. System Requirements

To develop with ZKAP, you need:

  • Node.js (v18+ recommended)

  • npm or yarn

  • A compatible ZK proof backend (Groth16, Plonk, Halo2, or STARK-based)

  • A running blockchain RPC endpoint (local or public)

  • Access to the ZKAP circuits and proving keys

Optional tools:

  • Docker (for isolated environments)

  • Circom or other custom ZK circuit compilers

  • pnpm for monorepo setups

  • WebAssembly support if generating proofs client-side


2. Install the ZKAP TypeScript SDK

The ZKAP SDK provides utilities for:

  • generating anonymous identities

  • encoding and encrypting payloads

  • generating zero-knowledge proofs

  • constructing ZKAP Frames

  • submitting frames to the validator contract

  • decrypting anonymous events

Install via npm:

npm install @zkap/sdk

or Yarn:

yarn add @zkap/sdk

or pnpm:

pnpm add @zkap/sdk

Once installed, you can import the SDK:

import {
generateIdentity,
encryptPayload,
generateProof,
buildFrame
} from "@zkap/sdk";

3. Install a ZK Proof Backend

Depending on your environment, you will need a proof generation backend.

Option A — Groth16 (fastest, lowest cost)

npm install snarkjs

Option B — Plonk

npm install @zk-kit/plonk

Option C — Halo2 or STARKs

Implemented via native bindings or WASM depending on the project.

The SDK can be configured to use any of these.


4. Install the ZKAP Validator Contract Package

If developing in Solidity:

npm install @zkap/contracts

This package includes:

  • ZKAP Validator contract

  • interfaces

  • event definitions

  • ABI files

It can be imported into Hardhat, Foundry, or any EVM framework.


For EVM developers:

  • Hardhat

  • Foundry (Forge/Anvil for testing)

  • Ethers.js or Viem for RPC calls

  • Typescript for SDK integration

For Agent developers:

  • Node.js

  • Secure key management

  • Encryption modules

  • Event listeners or task schedulers

For ZK developers:

  • Circom / Noir / Halo2 compiler

  • SnarkJS or Plonk toolkits

  • WASM runners


6. Setting up a Local Development Environment

Step 1: Clone or install the SDK Step 2: Install your chosen ZK backend Step 3: Download proving keys (if required) Step 4: Deploy the ZKAP Validator contract locally Step 5: Configure your app to listen to validator events Step 6: Begin sending encrypted frames for testing

A typical dev environment uses:

  • Anvil (Foundry) as a local EVM node

  • The ZKAP Validator deployed to Anvil

  • The SDK generating frames and proofs against that network


7. Example Project Setup

  1. Create a new project:

mkdir zkap-demo
cd zkap-demo
npm init -y
  1. Install dependencies:

npm install @zkap/sdk snarkjs ethers
  1. Write a simple script to generate and submit a frame:

import { buildFrame } from "@zkap/sdk";
import { ethers } from "ethers";

(async () => {
const frame = await buildFrame({ action: "ping" });
const provider = new ethers.JsonRpcProvider("http://localhost:8545");
const contract = new ethers.Contract(VALIDATOR_ADDRESS, ABI, provider);
await contract.submitFrame(frame);
})();

8. Troubleshooting Common Issues

  • Proof generation slow → enable WASM backend

  • Invalid proof error → mismatch between circuit + proving key

  • Contract rejects frame → nullifier already used

  • Expiry validation failed → expiry too low

  • Decryption fails → incorrect application key setup

The SDK provides detailed error messages to help with debugging.

Last updated