Skip to content
@Latens-ZK

Latens ZK

Zero-knowledge Bitcoin state verification layer deployed on Starknet

Zero-Knowledge Bitcoin State Verification on Starknet

Latens allows users to privately prove Bitcoin balance ownership or threshold conditions without revealing their address or exact balance on-chain

Overview

  • Privacy-First: Prove you own ≥X BTC without revealing your address or exact balance
  • Zero-Knowledge: Uses ZK proofs verified on Starknet
  • Bitcoin Native: Works with real Bitcoin blockchain data
  • Trustless: Cryptographically verifiable proofs
  • Modern UI: Glassmorphism design with live protocol statistics

The Tech

┌─────────────────┐
│  Bitcoin Chain  │
└────────┬────────┘
         │
         ▼
┌─────────────────┐      ┌──────────────┐
│  Indexer        │─────▶│ Merkle Tree  │
│  (Backend)      │      │  Builder     │
└─────────────────┘      └──────┬───────┘
                                │
                                ▼
                         ┌──────────────┐
                         │ ZK Circuit   │
                         │ (Cairo)      │
                         └──────┬───────┘
                                │
         ┌──────────────────────┴──────────────────────┐
         ▼                                             ▼
┌─────────────────┐                          ┌─────────────────┐
│  Frontend       │                          │  Starknet       │
│  (Next.js)      │─────────────────────────▶│  Contracts      │
└─────────────────┘      Submit Proof        └─────────────────┘

Project Structure

latens/
├── backend/              # Python backend service
│   ├── src/
│   │   ├── indexer/     # Bitcoin data fetching
│   │   ├── crypto/      # Merkle tree & Poseidon hash
│   │   ├── circuit/     # Cairo circuit & proof generation
│   │   ├── api/         # FastAPI server
│   │   └── models/      # Database models
│   ├── tests/
│   └── requirements.txt
├── contracts/           # Cairo smart contracts
│   ├── src/
│   │   ├── state_root_registry.cairo
│   │   └── proof_verifier.cairo
│   ├── tests/
│   └── Scarb.toml
├── frontend/            # Next.js frontend
│   ├── src/
│   │   ├── app/
│   │   ├── components/
│   │   └── lib/
│   └── package.json
└── docs/                # Documentation
    ├── prd.md
    └── flow.md

Setup Locally

Option A: Docker (Recommended)

Run the full stack (Frontend + Backend + DB) with one command:

docker-compose up --build

Option B: Manual Setup

1. Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Scarb (for contracts)
  • Starknet wallet (Argent/Braavos)

2. Backend Setup

cd backend
python -m venv venv
# Windows: venv\Scripts\activate | Mac/Linux: source venv/bin/activate
pip install -r requirements.txt
uvicorn src.api.main:app --reload

3. Frontend Setup

cd frontend
npm install
npm run dev

4. Smart Contracts

cd contracts
scarb build
# Deploy to Testnet (requires .env vars)
python scripts/deploy.py

Usage

Generate a Snapshot

cd backend
python -m src.scripts.generate_snapshot --block-height 800000

Start the API Server

cd backend
uvicorn src.api.main:app --reload

Access the Demo

Open browser to http://localhost:3000/demo

Flow

  1. Enter Bitcoin Address: Input your BTC address locally
  2. Generate Proof: Client-side commitment + backend proof generation
  3. Connect Wallet: Connect Starknet wallet (Argent/Braavos)
  4. Submit Proof: Verify on-chain without revealing address
  5. View Result: See verification status

Privacy Guarantees

  • ✅ Exact balance remains private
  • ✅ Salt prevents correlation attacks
  • ✅ Only threshold satisfaction is proven
  • ✅ Bitcoin address never appears on-chain

Testing

# Backend tests
cd backend
pytest tests/ -v

# Contract tests
cd contracts
scarb test

# Frontend tests
cd frontend
npm test

Documentation

  • PRD - Product Requirements Document
  • Flow - Detailed User Flow Specification
  • Implementation Plan - Technical Implementation Guide

Tech Stack

  • Backend: Python, FastAPI, SQLAlchemy
  • ZK Circuits: Cairo
  • Smart Contracts: Cairo on Starknet
  • Frontend: Next.js, TypeScript, TailwindCSS
  • Cryptography: Poseidon hash, Merkle trees

Use Cases

  1. Private Balance Verification: Prove ownership without revealing amount
  2. Threshold Gating: Access DAOs/services with ≥X BTC requirement
  3. Anonymous Reputation: Build cross-chain reputation from Bitcoin holdings
  4. Compliance Proofs: Prove non-interaction with blacklisted addresses

License

MIT

Contributing

This is a hackathon project. Contributions welcome!

🔗 Resources

Pinned Loading

  1. core core Public

    The core infra behind latens ZK ⛓️‍💥

Repositories

Showing 2 of 2 repositories

Top languages

Loading…

Most used topics

Loading…