An open API service indexing awesome lists of open source software.

https://github.com/hvuhsg/zkp

Zero knowledge proof creation and verification
https://github.com/hvuhsg/zkp

coloring-graph zero-knowledge

Last synced: about 1 year ago
JSON representation

Zero knowledge proof creation and verification

Awesome Lists containing this project

README

          

# Zero-Knowledge Proof Implementation

[![Go Tests](https://github.com/hvuhsg/zkp/actions/workflows/go-tests.yml/badge.svg?branch=main)](https://github.com/hvuhsg/zkp/actions/workflows/go-tests.yml)

This project implements a zero-knowledge proof system for graph coloring problems using Go. It provides a way to prove knowledge of a valid graph coloring without revealing the actual coloring solution.

## Overview

The implementation consists of three main components:
1. **Proofer**: Creates zero-knowledge proofs for graph coloring solutions
2. **Verifier**: Validates the proofs without revealing the actual coloring
3. **Graph Structures**: Implements various graph types and coloring mechanisms

## Features

- Zero-knowledge proof generation for graph coloring
- Cryptographic commitment scheme using SHA-1
- Graph serialization and deserialization
- Comprehensive test suite
- Benchmarking capabilities

## Project Structure

```
.
├── coloring_graph/ # Graph coloring implementation
├── commitment_graph/ # Commitment scheme for proofs
├── graph/ # Base graph data structures
├── proofer.go # Proof generation
├── verifier.go # Proof verification
├── randomizer.go # Random number generation for proofs
└── *_test.go # Test files
```

## Requirements

- Go 1.24.1 or higher
- Dependencies:
- github.com/stretchr/testify v1.10.0

## Installation

1. Clone the repository:
```bash
git clone https://github.com/hvuhsg/zkp.git
cd zkp
```

2. Install dependencies:
```bash
go mod download
```

## Usage

### Creating a Proof

```go
// Create a colored graph
coloredGraph := coloringgraph.NewColoringGraph(...)

// Initialize the proofer
proofer := zkp.NewProofer(coloredGraph)

// Generate a proof
proof := proofer.CreateProof(length)
```

### Verifying a Proof

```go
// Verify a proof
isValid := proof.Verify()
```

## Testing

Run the test suite:
```bash
go test ./...
```

Run benchmarks:
```bash
go test -bench=. ./...
```

## Security

This implementation uses SHA-1 for cryptographic commitments. While this is sufficient for demonstration purposes, for production use, consider using a more modern cryptographic hash function.