ZkpSharp 1.4.0

dotnet add package ZkpSharp --version 1.4.0
                    
NuGet\Install-Package ZkpSharp -Version 1.4.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="ZkpSharp" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZkpSharp" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="ZkpSharp" />
                    
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 ZkpSharp --version 1.4.0
                    
#r "nuget: ZkpSharp, 1.4.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 ZkpSharp@1.4.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=ZkpSharp&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=ZkpSharp&version=1.4.0
                    
Install as a Cake Tool

ZkpSharp

A .NET library for Zero-Knowledge Proofs with Stellar Soroban blockchain integration. Prove facts about private data (age, balance, membership, range, time conditions) without revealing the data itself.

NuGet License: MIT

Features

Privacy proofs (HMAC-based commitment schemes) -- fast, lightweight:

  • Proof of Age, Balance, Membership, Range, Time Condition
  • HMAC-SHA256 with cryptographic salt

True zero-knowledge proofs (Bulletproofs) -- mathematically sound:

  • ZK range, age, and balance proofs using Pedersen commitments
  • Compact serialization for storage and transmission

Stellar blockchain integration:

  • Soroban SDK 25 with BLS12-381 cryptography
  • On-chain verification via InvokeHostFunctionOp
  • SorobanTransactionBuilder for XDR construction

Installation

dotnet add package ZkpSharp

Quick start

using ZkpSharp.Core;
using ZkpSharp.Security;

var proofProvider = new ProofProvider("your-base64-encoded-32-byte-key");
var zkp = new Zkp(proofProvider);

// Prove age >= 18 without revealing birthdate
var (proof, salt) = zkp.ProveAge(new DateTime(1995, 3, 15));
bool valid = zkp.VerifyAge(proof, new DateTime(1995, 3, 15), salt);

// Prove sufficient balance without revealing actual amount
var (bProof, bSalt) = zkp.ProveBalance(1000.0, 500.0);
bool bValid = zkp.VerifyBalance(bProof, 500.0, bSalt, 1000.0);

For Bulletproofs (true ZKP):

using ZkpSharp.Security;

var zkProvider = new BulletproofsProvider();
var (proof, commitment) = zkProvider.ProveRange(value: 42, min: 0, max: 100);
bool valid = zkProvider.VerifyRange(proof, commitment, min: 0, max: 100);

See QUICKSTART.md for a complete walkthrough including Stellar integration.

API

Zkp -- HMAC-based privacy proofs

Method Description
ProveAge(DateTime dateOfBirth) Prove age >= 18 (configurable)
VerifyAge(string proof, DateTime dateOfBirth, string salt) Verify age proof
ProveBalance(double balance, double requestedAmount) Prove balance >= requested
VerifyBalance(string proof, double requestedAmount, string salt, double balance) Verify balance proof
ProveMembership(string value, string[] validValues) Prove value is in set
VerifyMembership(string proof, string value, string salt, string[] validValues) Verify membership proof
ProveRange(double value, double minValue, double maxValue) Prove value is in range
VerifyRange(string proof, double minValue, double maxValue, double value, string salt) Verify range proof
ProveTimeCondition(DateTime eventDate, DateTime conditionDate) Prove event after date
VerifyTimeCondition(string proof, DateTime eventDate, DateTime conditionDate, string salt) Verify time proof

All Prove* methods return (string Proof, string Salt). Salts are generated automatically and must be stored alongside proofs.

BulletproofsProvider -- True zero-knowledge proofs

Method Description
ProveRange(long value, long min, long max) ZK range proof
VerifyRange(byte[] proof, byte[] commitment, long min, long max) Verify ZK range proof
ProveAge(DateTime birthDate, int minAge) ZK age proof
VerifyAge(byte[] proof, byte[] commitment, int minAge) Verify ZK age proof
ProveBalance(long balance, long requiredAmount) ZK balance proof
VerifyBalance(byte[] proof, byte[] commitment, long requiredAmount) Verify ZK balance proof
SerializeProof(byte[] proof, byte[] commitment) Serialize for storage
DeserializeProof(string serialized) Deserialize proof

Prove* methods return (byte[] proof, byte[] commitment).

StellarBlockchain -- On-chain verification

var blockchain = new StellarBlockchain(
    serverUrl: "https://horizon-testnet.stellar.org",
    sorobanRpcUrl: "https://soroban-testnet.stellar.org",
    hmacKey: hmacKey
);

bool result = await blockchain.VerifyBalanceProof(contractId, proof, balance, required, salt);

SorobanTransactionBuilder -- Manual transaction construction

var builder = new SorobanTransactionBuilder(Network.Test());

// HMAC proof verification
string xdr = builder.BuildVerifyProofTransaction(contractId, proof, data, salt, hmacKey);

// ZK proof verification
string zkXdr = builder.BuildVerifyZkRangeProofTransaction(contractId, proof, commitment, min, max);
string ageXdr = builder.BuildVerifyZkAgeProofTransaction(contractId, proof, commitment, minAge);
string balXdr = builder.BuildVerifyZkBalanceProofTransaction(contractId, proof, commitment, required);

Soroban contract

The Rust smart contract (contracts/stellar/contracts/proof-balance/) exposes the following functions:

Function Description
verify_proof HMAC-SHA256 proof verification
verify_balance_proof Balance proof with numeric comparison
verify_batch Batch verification of multiple proofs
verify_zk_range_proof BLS12-381 ZK range verification
verify_zk_age_proof ZK age verification
verify_zk_balance_proof ZK balance verification

See contracts/stellar/README.md for contract details and contracts/stellar/DEPLOYMENT.md for deployment instructions.

Architecture

Application
  |
  +-- Zkp (HMAC proofs)
  +-- BulletproofsProvider (ZK proofs)
  |
  +-- StellarBlockchain
        +-- SorobanTransactionBuilder --> XDR
        +-- SorobanRpcClient --> Soroban RPC --> ZkpVerifier Contract

Security

  • Key management: Use environment variables for development. Use Azure Key Vault, AWS Secrets Manager, or HashiCorp Vault in production.
  • Salts: Never reuse. ZkpSharp generates cryptographically secure random salts automatically.
  • Contract verification: Always verify deployed contract code matches source.
  • Transaction fees: Soroban transactions require XLM.

Documentation

Document Description
QUICKSTART.md Step-by-step setup and usage guide
DEPLOYMENT.md Soroban contract deployment
STELLAR_REALITY_CHECK.md Capabilities and limitations
INTEGRATION_STATUS.md Feature status and migration guide
CHANGELOG.md Version history

Contributing

  1. Fork the repository
  2. Create a branch (git checkout -b feature/your-feature)
  3. Run tests (dotnet test)
  4. Submit a pull request

License

MIT License. See LICENSE for details.

Contact

sagynbaev6@gmail.com | GitHub Issues | NuGet

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 82 3/3/2026
1.3.2 690 12/3/2025
1.3.1 671 12/3/2025
1.3.0 1,262 12/3/2025 1.3.0 is deprecated because it has critical bugs.
1.1.1 208 1/2/2025
1.1.0 167 1/2/2025
1.0.0 172 1/2/2025

v1.4.0: True ZKP via Bulletproofs-style proofs (IZkProofProvider, BulletproofsProvider), Soroban SDK 25 with BLS12-381, SorobanTransactionBuilder for XDR construction, ZK range/age/balance verification on-chain, comprehensive test coverage with 64+ tests.