Skip to content

A Python implementation of zero-knowledge range proofs, allowing a prover to convince a verifier that a secret number lies within a specific range without revealing the number itself.

Notifications You must be signed in to change notification settings

nkrishang/zk-range-proof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZK Range Proof Implementation

A Python implementation of zero-knowledge range proofs, allowing a prover to convince a verifier that a secret number lies within a specific range without revealing the number itself.

  • run.py: Main script demonstrating the range proof protocol
  • prover.py and verifier.py: Prover and Verifier class implementations
  • utils.py: Helper functions for elliptic curve operations, vector arithmetic and such.

This repo is based on learnings from the free-to-read Rareskills ZK Book (Bulletproofs).

Prerequisites

  • Python 3.8 or higher
  • (Recommended) uv Python package manager

Installation

  1. Clone the repository:
git clone https://github.com/nkrishang/zk-range-proof.git
cd zk-range-proof
  1. Create and activate a virtual environment:
# Using uv (recommended)
uv venv
  1. Install dependencies
# Using uv (recommended)
uv pip install libnum py-ecc

Usage

# Using uv (recommended)
uv run run.py

This will create a zero knowledge proof that the provided v and n are such that v < 2^n and verify the proof. It prints "accepted" if the verification is successful.

About

A Python implementation of zero-knowledge range proofs, allowing a prover to convince a verifier that a secret number lies within a specific range without revealing the number itself.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages