Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.18 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.18 KB

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.