Skip to content
azank1Public

About

ZK-proof settlement research prototype — trust-minimized P2P exchange using zero-knowledge proofs and DKIM-verified attestations. Research/PoC.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

ZK2P Protocol

Zero-Knowledge Proof P2P Token Exchange on Solana.

Quick Start

cd anomi-zk-prototype

# Install dependencies
npm install

# Build programs
anchor build

# Run tests
npm test

# Deploy to devnet
npm run deploy:devnet

P2P Testing (Devnet)

# 1. Create test token
npm run p2p:create-token

# 2. Setup buyer wallet
npm run p2p:setup-buyer

# 3. Initialize market
npm run p2p:init-market <TOKEN_MINT>

# 4. Distribute tokens
npm run p2p:distribute

# 5. Run P2P swap test
npm run p2p:test

# 6. Verify order book
npm run p2p:fetch

ZK Email Verification

The settlement layer uses Zero-Knowledge proofs to verify email-based payment confirmations.

Quick Start:

cd zk-stuff
npm install
npm test  # Run email verification tests

See zk-stuff/README.md for detailed setup, implementation, and testing.

How It Works

Multi-Program Architecture:

  • Market - Order matching with CritBit tree-based order book
  • OrderStore - Persistent matched order storage
  • OrderProcessor - ZK proof validation and settlement

Order Flow:

  1. Users place limit/market orders (ASK to sell, BID to buy)
  2. Orders matched on-chain using price-time priority
  3. Tokens held in escrow during matching
  4. Matched orders stored for off-chain settlement
  5. ZK proofs validate fiat payment confirmations
  6. Tokens released upon proof verification

Key Features:

  • CritBit tree: O(log n) order operations
  • 5 order types: Limit, Market, Post-Only, IOC, FOK
  • Partial fills and self-trade prevention
  • Token escrow with SPL integration
  • ZK email verification for settlement

Documentation

Current Status

✅ Completed:

  • Core matching engine with CritBit trees
  • All 5 order types implemented
  • Token escrow system secure
  • ZK email verification circuit (DKIM + domain matching)
  • Email parsing and proof generation utilities
  • Comprehensive test suite

🚧 In Progress:

  • End-to-end P2P wallet testing
  • Phantom wallet UI integration
  • ZK proof integration with Solana program

⏳ Future:

  • Full RSA signature verification in circuit
  • Mainnet deployment

See workflow_ANOMI.md for detailed roadmap.

Contributing

This project follows a milestone-based development approach. See the workflow document for current status and next steps.

License

ISC

About

ZK-proof settlement research prototype — trust-minimized P2P exchange using zero-knowledge proofs and DKIM-verified attestations. Research/PoC.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages