← Back to list

Building with zkVerify: A Step-by-Step Guide to Scalable ZK Proof Verification

🚀 Introduction: Why zkVerify?

Rob DC · 2025-05-09 01:08 · 0 claps · 2.2 min read
#zkverify #nearx #rust #circuit #merkle-tree
Open on Medium ↗
Wiki topics: 📐 · Mathematics

Building with zkVerify: A Step-by-Step Guide to Scalable ZK Proof Verification

🚀 Introduction: Why zkVerify?

zkVerify is a modular blockchain built on Substrate, dedicated to efficiently verifying zero-knowledge proofs (ZKPs) off-chain and publishing attestations on-chain. It slashes verification costs by up to 50%+ compared to on-chain methods, enabling scalable dApps like zkRollups, private voting, and KYC systems.

Verify with Zero Knowledge

Verify with Zero Knowledge

Key Innovations

  • Proof Aggregation: Batch proofs into Merkle roots for cost-efficient on-chain verification.
  • Multi-Prover Support: Groth16, Plonky2, Risc Zero, and more.
  • Interoperability: Attestations are relayed to Ethereum, Base, and other EVM chains via smart contracts .

zkVerify Architecture

🔧 Core Components of zkVerify

1. Substrate-Based Blockchain

  • L1 PoS Chain: Specialized for ZKP verification, powered by the tVFY token.
  • Verifier Pallets: Modular pallets for different proof systems (e.g., Groth16, UltraPlonk).

2. Proof Submission Flow

  1. Submit Proofs: Via zkverifyjs SDK or direct RPC calls.
  2. Attestation Generation: Valid proofs are aggregated into Merkle roots and published on-chain.
  3. On-Chain Verification: Contracts verify attestations using Merkle proofs.

3. SDK (zkverifyjs)

  • Installation:
npm install zkverifyjs
  • Key Features:
  • Submit proofs (Groth16, Risc Zero, etc.) .
  • Listen for attestation events (NewAggregationReceipt) .
  • Register verification keys for reuse .

🛠 Step-by-Step: Verifying a Circom Proof

1. Circuit Setup

  • Example Circuit: Poseidon hash verification in Circom:
template Example() { signal input a; // Private input signal input b; // Public hash component hash = Poseidon(1); hash.inputs[0] <== a; assert(b == hash.out); }
  • Compile & Generate Proof: Use snarkjs to create proof.json and public.json.

2. Submit Proof via zkverifyjs

const { zkVerifySession } = require("zkverifyjs");
const session = await zkVerifySession.start()
  .Volta() // Testnet
  .withAccount("seed_phrase");

// Register verification key (Groth16)
const { events } = await session.registerVerificationKey()
  .groth16({ library: "snarkjs", curve: "bn128" })
  .execute(vkey);
// Submit proof
await session.verify()
  .groth16({ library: "snarkjs", curve: "bn128" })
  .execute({
    proofData: { proof, vk: vkeyHash, publicSignals },
    domainId: 0, // Target chain (e.g., Ethereum)
  });
  • Listen for Attestation:
events.on("NewAggregationReceipt", (event) => { console.log("Attestation ID:", event.aggregationId); });

3. On-Chain Verification

  • Smart Contract: Verify attestations using IVerifyProofAggregation.sol:
function verifyProof( uint256 domainId, uint256 aggregationId, bytes32 leaf, bytes32[] calldata merklePath ) external view returns (bool) { 
    return IVerifyProofAggregation(zkVerify).verifyProofAggregation( domainId, aggregationId, leaf, merklePath, leafCount, index );
 }
  • Leaf Calculation:
bytes32 leaf = keccak256(abi.encodePacked( PROVING_SYSTEM_ID, // e.g., "groth16" vkeyHash, VERSION_HASH, keccak256(abi.encodePacked(publicInputs)) ));

🌐 Supported Chains & Use Cases

Deployed Networks

  • Testnets: Sepolia, Base Sepolia, Arbitrum Sepolia.
  • EVM Compatibility: Attestations are relayed via smart contracts.

Use Cases

  1. zkRollups: Batch-verify transactions.
  2. Private Voting: Prove eligibility without revealing identity.
  3. KYC: Verify credentials off-chain.

📌 Key Takeaways

  1. Cost Savings: zkVerify reduces gas costs by 50%+ for ZKP verification.
  2. Modular Design: Supports multiple proving systems (Groth16, Plonky2, etc.).
  3. SDK Integration: zkverifyjs simplifies proof submission and event listening.
  4. On-Chain Verification: Use Merkle proofs to validate attestations.

Learn more:


메타데이터
post_id
64fbef8faeda
slug
building-with-zkverify-a-step-by-step-guide-to-scalable-zk-proof-verification-64fbef8faeda
url
https://medium.com/@pavusa/building-with-zkverify-a-step-by-step-guide-to-scalable-zk-proof-verification-64fbef8faeda
canonical_url
https://medium.com/@pavusa/building-with-zkverify-a-step-by-step-guide-to-scalable-zk-proof-verification-64fbef8faeda
author_url
https://medium.com/@pavusa
status
ok
fetched_at
2026-06-26 03:39:16