๐ FestFund - Privacy-First Fundraising
Tech Stack:
Note : This project is no longer actively maintained. It was built as a demo for the Midnight Network Hackathon and serves as a reference implementation for privacy-first fundraising using zero-knowledge proofs.
Thanks to Midnight:
๐ 418x Performance Boost: ZK proof generation reduced from 418ms to 1ms
๐ Enterprise-Grade Privacy: Built-in ZK circuits optimized for scale
๐๏ธ Production Ready: Robust testnet-02 infrastructure
How I Used in FestFund:
- ZK Proof Infrastructure - Automatic fallback to self-hosted mode
- Privacy Primitives - Built-in cryptographic operations work in both modes
- Wallet Integration - Seamless user authentication (MetaMask)
- Network Reliability - Self-hosted mode ensures 100% uptime
๐ฏ Integration Benefits
For Users:
- โก Fast proof generation (1ms with Midnight, 418ms self-hosted)
- ๐ True privacy protection (guaranteed in both modes)
- ๐ Transparent rankings without data exposure
- ๐ป Smooth wallet connectivity
For Developers:
- ๐ฆ No external dependencies required (self-hosted mode)
- ๐ง Easy-to-use APIs and endpoints
- ๐ Automatic mode switching based on availability
๐ ZK Mode Comparison
Traditional ZK Solutions
- Complex circuit compilation
- Slow proof generation (418ms+)
- Manual infrastructure setup
- Limited documentation
Midnight Network
- 1ms proof generation
- Pre-optimized circuits
- Comprehensive documentation
- Active developer community
Private donations + Public rankings + Cryptographic verification = Privacy + Transparency solved
- ๐ Midnight Challenge:
MIDNIGHT_CHALLENGE_SUBMISSION.md
- ๐ง API Documentation: Backend routes in
/backend/routes/
- ๐ฏ ZK Circuits: Pre-compiled circuits in
/zk/build/
๐Quick Explanation for Busy People
Built with dual ZK infrastructure - works with or without Midnight Network
๐ Private Donations: Amounts cryptographically hidden using ZK proofs
๐ Public Recognition: Verifiable leaderboard rankings without revealing amounts
โก Flexible Infrastructure: Midnight Network (1ms) OR self-hosted (418ms)
๐ฏ Smart Milestones: Cryptographic proof of goal achievement
๐ฅ Dual Dashboards: Separate interfaces for donors and organizers
๐ฎ Achievement System: Gamified experience with unlockable badges
๐ฑ Responsive Design: Works perfectly on all devices
๐ Wallet Authentication: Secure MetaMask integration / Midnight Wallet (if available)
๐ Quick Start
# Create hardhat blockchain, deploy contracts and use the wallet address
npx hardhat node
npm run deploy # in root
# Backend Start
cd backend && npm install && npm start
# โ
Backend running on http://localhost:3001
# Start Frontend (new terminal)
cd frontend && npm install && npm run dev
# โ
Frontend running on http://localhost:3000
# Backend .env can be ignored , backend can take from root
root .env:
NODE_ENV=development
APP_URL=http://localhost:3000
USE_MOCK_MODE=true
PORT=3001
BACKEND_URL=http://localhost:3001
CORS_ORIGIN=http://localhost:3000,http://localhost:3001
NEXT_PUBLIC_BACKEND_URL=http://localhost:3001
NEXT_PUBLIC_APP_NAME=FestFund
NEXT_PUBLIC_APP_DESCRIPTION=Privacy-First Donation Platform
NEXT_PUBLIC_USE_MOCK_WALLET=true
NEXT_PUBLIC_ENABLE_ANALYTICS=false
NEXT_PUBLIC_ENABLE_NOTIFICATIONS=true
NEXT_PUBLIC_DEFAULT_THEME=light
MONGODB_URI=&appName=
JWT_SECRET=your-super-secret-jwt-key-change-for-production
BCRYPT_SALT_ROUNDS=12
GEMINI_API_KEY=
NEXT_PUBLIC_BLOCKCHAIN_RPC=http://localhost:8545
NEXT_PUBLIC_CHAIN_ID=31337
PRIVATE_KEY=7c60d2cd7f18a7891ae8b169f2fdf082d44206acf9c331e81113343537b81fd0
NEXT_PUBLIC_FUND_MANAGER_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
NEXT_PUBLIC_VERIFIER_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
NEXT_PUBLIC_MOCK_ERC20_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
ZK_MODE=midnight-network
NEXT_PUBLIC_ZK_MODE=midnight-network
ZK_CIRCUIT_PATH=./zk/circuits
ZK_PROVING_KEY_PATH=./zk/build/proving_key.zkey
ZK_VERIFICATION_KEY_PATH=./zk/build/verification_key.json
ZK_CIRCUIT_WASM_PATH=./zk/build/donation_commitment_v1.wasm
VERIFIER_CONTRACT_PATH=./contracts/Verifier.sol
MIDNIGHT_RPC_URL=https://rpc.testnet-02.midnight.network
MIDNIGHT_INDEXER_URL=https://indexer.testnet-02.midnight.network/api/v1/graphql
MIDNIGHT_INDEXER_WS_URL=wss://indexer.testnet-02.midnight.network/api/v1/graphql/ws
MIDNIGHT_NETWORK_ID=TestNet
MIDNIGHT_WALLET_SEED=your_64_character_hex_seed_here_or_mnemonic_phrase
NEXT_PUBLIC_MIDNIGHT_RPC_URL=https://rpc.testnet-02.midnight.network
NEXT_PUBLIC_MIDNIGHT_NETWORK_ID=TestNet
NEXT_PUBLIC_MIDNIGHT_EXPLORER_URL=https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.testnet-02.midnight.network
ENABLE_LOGGING=true
# My Frontend .env.local
NEXT_PUBLIC_BACKEND_URL=http://localhost:3001
NEXT_PUBLIC_APP_NAME=FestFund
NEXT_PUBLIC_APP_DESCRIPTION=Privacy-First Donation Platform with Zero-Knowledge Proofs
NEXT_PUBLIC_CHAIN_ID=31337
NEXT_PUBLIC_ENABLE_ANALYTICS=false
NEXT_PUBLIC_ENABLE_NOTIFICATIONS=true
NEXT_PUBLIC_BLOCKCHAIN_RPC=http://localhost:8545
NEXT_PUBLIC_FUND_MANAGER_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
NEXT_PUBLIC_VERIFIER_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
NEXT_PUBLIC_MOCK_TOKEN_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
NODE_ENV=development
Privacy + Transparency Solution
๐ Donations stay 100% private - amounts cryptographically hidden
๐ Public recognition guaranteed - verifiable leaderboard rankings
โก ZK infrastructure - proves the magic of Midnight Network
๐ฏ Smart milestone releases - funds unlock when goals are proven achieved
Dual ZK Architecture
Midnight Network Mode โก
- Official testnet-02 integration
- 1ms proof generation
Self-Hosted Mode ๐
- Complete independence
- 418ms proof generation
- Full privacy control
Tech Stack
Privacy Infrastructure: Midnight Network (Testnet-02)
Frontend: React/Next.js + TypeScript + Tailwind (Dark Mode)
Backend: Express.js + MongoDB + JWT Auth
Blockchain: Solidity + Hardhat + ZK Circuits
ZK Integration: Circom + SnarkJS + Official Midnight SDK
Screenshots









Architecture Diagram
graph TB
%% Core Components (8 total)
USER[๐ฅ Users & Donors]
FRONTEND[๐จ Next.js Frontend<br/>:3000]
BACKEND[โก Express.js API<br/>:3001]
DATABASE[(๐พ MongoDB<br/>Database)]
BLOCKCHAIN[๐ Smart Contracts<br/>Hardhat Network/Midnight Network]
%% ZK Infrastructure
ZK_LOCAL[๐ Self-Hosted ZK<br/>Circom + SnarkJS<br/>418ms Proofs<br/>]
MIDNIGHT[๐ Midnight Network<br/>Testnet-02<br/>1ms ZK Proofs<br/>โ
Default Mode]
%% Privacy Layer
PRIVACY[๐ Privacy Layer<br/>Private Donations<br/>Public Rankings]
%% Main Flow
USER --> FRONTEND
FRONTEND <--> BACKEND
BACKEND <--> DATABASE
BACKEND <--> BLOCKCHAIN
%% ZK Integration (Dual Mode - Self-hosted is primary)
BACKEND --> ZK_LOCAL
BACKEND -.-> MIDNIGHT
ZK_LOCAL --> PRIVACY
MIDNIGHT -.-> PRIVACY
%% Smart Contract Integration
FRONTEND --> BLOCKCHAIN
%% Styling
classDef userNode fill:#6b7280,stroke:#374151,color:#fff
classDef frontendNode fill:#3b82f6,stroke:#1d4ed8,color:#fff
classDef backendNode fill:#10b981,stroke:#047857,color:#fff
classDef dbNode fill:#f59e0b,stroke:#d97706,color:#fff
classDef blockchainNode fill:#6366f1,stroke:#4338ca,color:#fff
classDef zkNode fill:#ec4899,stroke:#be185d,color:#fff
classDef midnightNode fill:#7c3aed,stroke:#5b21b6,color:#fff,stroke-dasharray: 5 5
classDef privacyNode fill:#8b5cf6,stroke:#7c2d12,color:#fff
class USER userNode
class FRONTEND frontendNode
class BACKEND backendNode
class DATABASE dbNode
class BLOCKCHAIN blockchainNode
class ZK_LOCAL zkNode
class MIDNIGHT midnightNode
class PRIVACY privacyNode
Project Structure
festfund/
โโโ backend/ # Express.js API server
โ โโโ routes/ # API endpoints (auth, privacy, proofs, rankings, achievements)
โ โโโ models/ # MongoDB data models
โ โโโ services/ # Business logic services
โ โโโ utils/ # Midnight integration & utilities
โโโ frontend/ # Next.js React application
โ โโโ components/ # UI components (privacy, campaigns, leaderboards)
โ โโโ pages/ # Application pages
โ โโโ contexts/ # React contexts (wallet, auth)
โ โโโ lib/ # Smart contract integration & utilities
โโโ contracts/ # Solidity smart contracts (FundManager, Verifier, MockERC20)
โโโ zk/ # ZK circuit files (Circom circuits, compiled artifacts)
โโโ scripts/ # Deployment and setup scripts
โโโ artifacts/ # Hardhat compilation artifacts
๐ Privacy + Transparency = Cryptographic Magic
Powered by Midnight Network's ZK and Wallet infrastructure
Built with ๐ for the Midnight Network community - Arya Singh