Skip to content

JulesWi/GeoPrivacy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🌍 GeoPrivacy: Zero-Knowledge Geolocation Proof System

πŸš€ Overview

GeoPrivacy is an innovative web application that generates zero-knowledge proofs for location verification, ensuring maximum privacy and security. The application has been updated with improved TypeScript configuration and testing capabilities.

✨ Features

  • πŸ”’ Zero-Knowledge Location Proofs
  • πŸ—ΊοΈ Interactive Map Integration
  • πŸ›‘οΈ Privacy-First Design
  • πŸ“ Precise Location Verification

πŸ›  Tech Stack

  • Frontend: React 18 with TypeScript
  • Styling: Tailwind CSS with primary (light green) and secondary (light blue) colors
  • Mapping: React Leaflet
  • Zero-Knowledge Proofs: Noir Circuit and Aztec Network
  • Testing: Jest and React Testing Library

🌐 Getting Started

# Install dependencies
npm install --legacy-peer-deps

# Start frontend
npm run start:frontend

# Start backend
npm run start:backend

# Run tests
npm test

πŸ’° Payment Model

GeoPrivacy introduces an innovative payment mechanism for Zero-Knowledge Proofs:

  • Network: OP Sepolia
  • Proof Generation Cost: 0.5 USDC
  • Smart Contract: GeoPrivacyPayment.sol

How It Works

  1. Purchase a proof token via our smart contract
  2. Token is valid for a single ZK proof generation
  3. Secure and traceable blockchain-based payment

Requirements

  • Web3 Wallet compatible with OP Sepolia
  • USDC on OP Sepolia
  • Web3 Connection

Prerequisites

  • Node.js (v18+)
  • npm or yarn
  • React 18.x (for compatibility with react-leaflet)
  • TypeScript 5.x

Security and Testing

Smart Contract Security

  • Comprehensive unit testing
  • Static code analysis
  • Gas optimization
  • Regular security audits

Continuous Integration

  • Automated tests on every push and pull request
  • Code coverage reporting
  • Security vulnerability scanning
  • Vercel deployment with GitHub Actions
    • Configured with VERCEL_TOKEN, VERCEL_ORG_ID, and VERCEL_PROJECT_ID secrets

Test Commands

# Run all contract tests
npm run test:contracts

# Generate test coverage report
npm run test:contracts:coverage

# Analyze gas usage
npm run test:contracts:gas

Security Best Practices

  • All sensitive data managed via environment variables
  • Private keys and API keys never committed to repository
  • Regular dependency updates
  • Implemented access control mechanisms

Smart Contract Deployment

OP Sepolia Deployment

  1. Set up environment variables:
cp .env.example .env
# Edit .env and add:
# OP_SEPOLIA_RPC_URL=https://sepolia.optimism.io
# PRIVATE_KEY=your_private_key
# OPTIMISM_ETHERSCAN_API_KEY=your_api_key
  1. Deploy the contract:
npx hardhat run scripts/deploy.ts --network op-sepolia
  1. Verify the contract (optional):
npx hardhat verify --network op-sepolia DEPLOYED_CONTRACT_ADDRESS

Deployment Details

  • Network: OP Sepolia
  • Token Cost: 0.5 USDC
  • Smart Contract: GeoPrivacyPayment.sol
  • npm

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/geoprivacy.git
  2. Install dependencies

    cd geoprivacy/frontend
    npm install
  3. Run development server

    npm run dev

πŸš€ Deployment

Deployed on Netlify. Visit GeoPrivacy App

πŸ”’ Privacy Commitment

We use zero-knowledge proofs to verify location without revealing sensitive data.

πŸ“„ License

MIT License

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines.

πŸ‘₯ Team

AztecNoir Team - Privacy Innovators project using Zero-Knowledge Proofs with Noir and Aztec Network

🌍 Project Overview

GeoPrivacy is a cutting-edge application that allows users to generate zero-knowledge proofs of their location without revealing exact coordinates. Using the Noir ZK framework, users can prove they are within a certain radius of a specified location (Paris) without disclosing their exact position.

πŸ› οΈ Technical Architecture

  • Frontend: Next.js + React (TypeScript)
  • Zero-Knowledge Proofs: Noir circuits
  • Verification: Custom Haversine distance calculation

πŸ“ Project Structure

/GeoPrivacy
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ circuits/           # Noir ZK circuits
β”‚   β”‚   β”œβ”€β”€ src/main.nr     # Main circuit implementation
β”‚   β”‚   └── Nargo.toml      # Circuit configuration
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”œβ”€β”€ pages/              # Next.js pages
β”‚   └── tests/              # Frontend tests
└── docs/                   # Project documentation

πŸš€ Features

  • Location Verification: Prove presence within a radius of Paris
  • Timestamp Verification: Ensure the proof is recent (within 24 hours)
  • Privacy-Preserving: Zero-knowledge proofs reveal nothing about exact coordinates

βš™οΈ Setup and Installation

Dependency Management

To keep dependencies up to date, use the following scripts:

Unix/Linux/macOS

./update_deps.sh

Windows

.\update_deps.ps1

These scripts will:

  • Update npm packages
  • Run npm audit fix
  • Update Noir circuit dependencies
  1. Install Dependencies:
npm install
  1. Install Noir/Nargo (if not already installed):
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noisup -v 1.0.0-beta.3
  1. Compile Circuit:
cd frontend/circuits
nargo compile
  1. Run Development Server:
cd frontend
npm run dev

πŸ§ͺ Testing

  1. Circuit Testing:
cd frontend/circuits
nargo compile  # Compile the circuit
nargo execute  # Execute with inputs from Prover.toml
nargo info     # View circuit info and metrics
  1. Frontend Tests:
npm test

πŸ’» Commands Reference

  • Lint Code: npm run lint
  • Fix Lint Issues: npm run lint:fix
  • Type Check: npm run typecheck
  • Build for Production: npm run build

πŸ“‹ Requirements Checklist

  • Meaningful Use of Noir
  • Public GitHub repository
  • Clear README
  • Working frontend (Γ  complΓ©ter)
  • Demo recording (Γ  complΓ©ter)

πŸ” Noir Circuit Implementation

The core of GeoPrivacy is a Noir circuit that implements:

  1. Custom Trigonometric Functions: Approximations for sine and cosine using Taylor series
  2. Haversine Distance Calculation: For accurate Earth-surface distance calculations
  3. Radius Constraint: Verify user is within specified radius of target
  4. Timestamp Verification: Ensure proof is recent

About

Zero-Knowledge Location Proof System

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published