🌟 Key Features

Zero-Knowledge Escrow: Leverages Zcash's shielded transactions for private fund management Smart Contract Integration: NEAR smart contracts for escrow logic and intent matching Privacy-Preserving Identity: Shielded addresses and private reputation system Cross-Chain Compatibility: Seamless integration between Zcash and NEAR Intent Matching System: Privacy-preserving matching of clients and freelancers Shielded Payments: Private transaction history and earnings tracking

🏗️ Architecture

graph TB subgraph Frontend UI[Web Interface] Wallet[Wallet Integration] ZK[Zero-Knowledge Proofs] UI --> Wallet UI --> ZK Wallet --> ZK end

  subgraph Backend
        API[API Server]
        DB[(SQLite Database)]
        Monitor[Transaction Monitor]
        API --> DB
        API --> Monitor
  end

  subgraph Blockchain
        ZCASH[Zcash Network]
        NEAR[NEAR Network]
        ZECVault[ZecVault Contract]
        Intent[Intent Contract]
        Monitor --> ZCASH
        Monitor --> NEAR
        API --> ZECVault
        API --> Intent
  end

  subgraph Privacy Layer
        Shield[Shielded Transactions]
        Proof[Zero-Knowledge Proofs]
        Match[Private Matching]
        ZK --> Shield
        ZK --> Proof
        API --> Match
  end

  Shield --> ZCASH
  Proof --> NEAR
  Match --> Intent

Core Components Frontend Layer

Next.js web application Wallet integration (Y Wallet, Zingo, Zashi) Zero-knowledge proof generation Privacy-preserving UI components Backend Services

Node.js API server SQLite database Transaction monitoring service Intent matching system Blockchain Integration

Zcash shielded transactions NEAR smart contracts Cross-chain communication Privacy Layer

Shielded transaction handling Zero-knowledge proof generation Private intent matching Cross-chain verification 📜 Smart Contracts ZecVault Contract (Base Sepolia) View Contract Code

Address: 0xD6D0F20D055748302877a2a635a22F5dD0d0433D Key Functions:

deposit: Shielded deposit of ZEC withdraw: Private withdrawal with zero-knowledge proof createEscrow: Initialize new escrow agreement releaseFunds: Release funds to recipient Intent Contract (NEAR) View Contract Code

Account: cbof.testnet Key Functions:

createIntent: Create new intent for matching matchIntent: Privacy-preserving intent matching verifyProof: Verify zero-knowledge proofs updateStatus: Update intent status 🚀 Getting Started Prerequisites Node.js v18+ Rust toolchain NEAR CLI Zcash lightwalletd SQLite3 Quick Start

Clone and install

git clone https://github.com/cbof16/ZSecretEscrow.git cd ZSecretEscrow npm install

Initialize database

npm run db:init

Start the application

npm run start Detailed Setup Clone the repository: git clone https://github.com/cbof16/ZSecretEscrow.git cd ZSecretEscrow Install dependencies:

Frontend

cd web npm install

Backend

cd ../src npm install Configure environment: cp .env.example .env

Update .env with your configuration

Initialize database:

From the src directory

npm run db:init

This will create the database and run migrations

Start the application:

Start both frontend and backend

npm run start

Or start them separately:

Backend

cd src npm run dev

Frontend (in a new terminal)

cd web/src/client npm run dev Access the application: http://localhost:3000 Database Initialization The application requires a SQLite database to be initialized before first use. This database stores:

User profiles Escrow agreements Transaction history Intent matching data Run the following commands to initialize the database:

cd src npm run db:init This will:

Create the SQLite database file Run all migrations Seed initial data if needed 🔒 Privacy Features Zero-Knowledge Proofs Shielded transaction amounts Private reputation scores Confidential escrow details Hidden payment history Shielded Addresses Private wallet addresses Untraceable transactions Confidential user profiles Hidden activity history 🎥 Demo [Demo Video Link]

Key Demo Scenarios Private Escrow Creation

Create shielded escrow Generate zero-knowledge proof Verify on-chain Intent Matching

Create private intent Match with compatible parties Verify matches privately Shielded Payments

Receive private payments Track shielded earnings View private transaction history 📸 Screenshots Running Service

Running Service 🔧 Technical Stack Frontend Next.js 15 TypeScript Tailwind CSS Shadcn UI Zero-knowledge proof generation Backend Node.js Express SQLite NEAR Protocol SDK Zcash lightwalletd Blockchain Zcash (shielded transactions) NEAR Protocol (smart contracts) Base Sepolia (ZecVault) 📚 API Documentation Core Endpoints Escrow Management // Create a new escrow agreement POST /api/escrow/create Request: { "amount": "1.5", "receiverAddress": "zs1...", "deadlineTimestamp": 1678954321, "terms": "Project delivery by specified date" } Response: { "id": "esc-12345", "status": "created", "shieldedTxId": "txid..." }

// Release funds from escrow POST /api/escrow/release Request: { "escrowId": "esc-12345", "proof": "base64encodedproof..." } Response: { "success": true, "txId": "txid..." }

// Get escrow details GET /api/escrow/:id Response: { "id": "esc-12345", "amount": "1.5", "status": "active", "createdAt": "2023-06-15T10:30:00Z", "deadline": "2023-07-15T10:30:00Z" } Intent Matching // Create a new intent POST /api/intent/create Request: { "type": "service", "category": "development", "budget": "2.5", "description": "Smart contract development", "private": true } Response: { "intentId": "int-67890", "status": "pending" }

// Get matching intents GET /api/intent/matches Response: { "matches": [ { "intentId": "int-12345", "category": "development", "compatibility": 0.85, "shieldedDetails": true }, // More matches... ] }

// Accept an intent match POST /api/intent/accept Request: { "matchId": "match-12345", "proof": "base64encodedproof..." } Response: { "success": true, "escrowId": "esc-54321" } Privacy Features // Shield a transaction POST /api/privacy/shield Request: { "amount": "3.0", "memo": "Payment for services" } Response: { "success": true, "shieldedTxId": "txid..." }

// Generate zero-knowledge proof GET /api/privacy/proof Request: { "type": "reputation", "minimumScore": 4.5 } Response: { "proof": "base64encodedproof...", "expiresAt": "2023-07-01T00:00:00Z" } Balance & Transactions // Get user balance GET /api/balance Response: { "balance": "5.25", "pendingBalance": "1.5", "shielded": true }

// Get transaction history GET /api/transactions Response: { "transactions": [ { "id": "tx-12345", "amount": "1.5", "type": "deposit", "timestamp": "2023-06-10T08:25:00Z", "shielded": true }, // More transactions... ] } User Profile // Get user profile GET /api/user/profile Response: { "username": "user123", "reputation": 4.8, "completedEscrows": 12, "shieldedIdentity": true }

// Update user profile PATCH /api/user/profile Request: { "displayName": "New Name", "contactInfo": "encrypted-contact-data" } Response: { "success": true, "updated": ["displayName", "contactInfo"] } 🔐 Security Considerations Zero-knowledge proofs for all sensitive operations Shielded transactions for fund management Private reputation system Secure key management Cross-chain verification 🤝 Contributing Fork the repository Create your feature branch Commit your changes Push to the branch Create a Pull Request 📝 License This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments Zcash Foundation NEAR Protocol Base Protocol All contributors and supporters

Built With

Share this project:

Updates