Skip to main content

zksdk

Build ZK apps with ease and efficiency

An open-source SDK for zero-knowledge development
Get Started
zkmerkle.ts
import { ZkMerkle } from 'zkmerkle'

// Create a new ZK Merkle Tree
const zkMerkle = new ZkMerkle()

// Add some data to your tree
const myData = [🌳, 🌲, 🌴 , 🌱, 🌿, 🍃]

// Calculate tree depth
const depth = Math.ceil(Math.log2(myData.length))

// Generate a proof
const { proof, publicSignals, root } = 
  await zkMerkle.generateMerkleProof(🍃, myData)

// Verify the proof
const isValid = await zkMerkle.verifyProof(
  proof, 
  publicSignals, 
  depth
);

console.log(`Verification: ${isValid ? '✅' : '❌'})

// Export the verifier contract
const contractVerifier = await zkMerkle.exportVerifier()