Nethereum.ZkProofsVerifier 7.1.0

Prefix Reserved
dotnet add package Nethereum.ZkProofsVerifier --version 7.1.0
                    
NuGet\Install-Package Nethereum.ZkProofsVerifier -Version 7.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nethereum.ZkProofsVerifier" Version="7.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nethereum.ZkProofsVerifier" Version="7.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Nethereum.ZkProofsVerifier" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nethereum.ZkProofsVerifier --version 7.1.0
                    
#r "nuget: Nethereum.ZkProofsVerifier, 7.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nethereum.ZkProofsVerifier@7.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nethereum.ZkProofsVerifier&version=7.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Nethereum.ZkProofsVerifier&version=7.1.0
                    
Install as a Cake Tool

Nethereum.ZkProofsVerifier

Native .NET Groth16 proof verification for Circom/snarkjs circuits on the BN128 curve. Verify zero-knowledge proofs entirely in C# without external dependencies on native libraries or JavaScript runtimes.

Overview

Nethereum.ZkProofsVerifier implements the Groth16 zero-knowledge proof verification algorithm using BN128 elliptic curve pairings. It directly consumes the JSON output files produced by snarkjs (proof.json, verification_key.json, public.json), making it straightforward to integrate Circom circuit verification into .NET applications.

Key capabilities:

  • One-liner verification via CircomGroth16Adapter.Verify(proofJson, vkJson, publicJson)
  • Step-by-step API for parsing and verifying proofs independently
  • Tamper detection — modified proofs, inputs, or verification keys are rejected
  • EVM-compatible — produces the same results as Solidity Groth16 verifier contracts

Installation

dotnet add package Nethereum.ZkProofsVerifier

Dependencies

  • Nethereum.Signer — BN128 curve arithmetic, Fp2/Fp12 extension fields, and optimal Ate pairing

Quick Start

using Nethereum.ZkProofsVerifier.Circom;

// Load snarkjs output files
var proofJson = File.ReadAllText("proof.json");
var vkJson = File.ReadAllText("verification_key.json");
var publicJson = File.ReadAllText("public.json");

// Verify in one line
var result = CircomGroth16Adapter.Verify(proofJson, vkJson, publicJson);

if (result.IsValid)
    Console.WriteLine("Proof verified!");
else
    Console.WriteLine($"Verification failed: {result.Error}");

Usage Examples

Example 1: End-to-End Verification with CircomGroth16Adapter

using Nethereum.ZkProofsVerifier.Circom;

var result = CircomGroth16Adapter.Verify(proofJson, vkJson, publicInputsJson);

if (result.IsValid)
{
    Console.WriteLine("Proof is valid!");
}
else
{
    Console.WriteLine($"Verification failed: {result.Error}");
}

Example 2: Detecting Tampered Proofs

Verification rejects any modification to the proof, inputs, or verification key:

using Nethereum.ZkProofsVerifier.Circom;

// Verify with wrong public inputs
var tamperedPublicJson = "[\"999\"]";
var result = CircomGroth16Adapter.Verify(proofJson, vkJson, tamperedPublicJson);
// result.IsValid == false — inputs don't match what was proven

// Verify with mismatched circuit files
var result2 = CircomGroth16Adapter.Verify(proofJsonA, vkJsonB, publicJsonA);
// result2.IsValid == false — VK doesn't match the proof's circuit

API Reference

CircomGroth16Adapter

The public entry point for verifying snarkjs/Circom proofs. Parses all three JSON files internally and runs the BN128 pairing check.

public static class CircomGroth16Adapter
{
    public static ZkVerificationResult Verify(
        string proofJson,
        string vkJson,
        string publicInputsJson);
}

ZkVerificationResult

Immutable result of a verification attempt.

public class ZkVerificationResult
{
    public bool IsValid { get; }
    public string Error { get; }

    public static ZkVerificationResult Valid();
    public static ZkVerificationResult Invalid(string reason);
}

Verification Algorithm

Internally, the adapter parses the JSON inputs into BN128 curve points and checks the Groth16 pairing equation:

e(-A, B) · e(Alpha, Beta) · e(vkX, Gamma) · e(C, Delta) == 1

Where vkX = IC[0] + sum(IC[i+1] * publicInputs[i]).

All cryptographic types (curve points, field extensions, parsers) are internal implementation details — consumers only interact with CircomGroth16Adapter and ZkVerificationResult.

Supported Formats

File Format Description
proof.json { "pi_a": [x,y], "pi_b": [[x0,x1],[y0,y1]], "pi_c": [x,y] } Proof elements (G1 + G2 + G1)
verification_key.json { "vk_alpha_1", "vk_beta_2", "vk_gamma_2", "vk_delta_2", "IC" } Verification key from trusted setup
public.json ["input1", "input2", ...] Public circuit inputs as decimal strings
  • Nethereum.Signer — BN128 curve operations, Fp2/Fp12 extension fields, optimal Ate pairing
  • Nethereum.Util — Poseidon hashing (PoseidonHasher with CircomT1/CircomT2/CircomT3 presets) for ZK circuit inputs
  • Nethereum.Merkle — Sparse Merkle Binary Tree with PoseidonSmtHasher for ZK-compatible state trees
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net451 is compatible.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Nethereum.ZkProofsVerifier:

Package Downloads
Nethereum.PrivacyPools

Nethereum PrivacyPools - 0xbow Privacy Pools protocol SDK with Poseidon commitments, LeanIMT, and Groth16 proof verification

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.1.0 62 11/10/2026
7.0.0 152 10/2/2026
6.1.0 194 3/25/2026