DEV Community

Cover image for FestFund: Private Contributions & Public Recognition - A Zero-Knowledge Fundraising Solution
Arya Pratap Singh
Arya Pratap Singh

Posted on

FestFund: Private Contributions & Public Recognition - A Zero-Knowledge Fundraising Solution

Midnight Network Challenge: Protect That Data

This is a submission for the Midnight Network "Privacy First" Challenge - Protect That Data prompt.

Quick Links:

Midnight Network Live Demo Demo - YouTube Demo-Vimeo GitHub - Repository


Tech Stack:

Next.js TypeScript Node.js MongoDB Solidity Vercel

Note: Terms Donor and Contributor have been used interchangebly and mean the same 'THE VALUE ADDITION PARTY WHICH GENERATES A ZKP.

What I Built

FestFund solves fundraising's one of the hardest paradox: the choice between donor privacy and transparent recognition. Using Midnight Network's ZK infrastructure, I built a platform where donation amounts/transactions/wallet addresses/names are other important parameters remain completely private while maintaining verifiable public leaderboards and milestone tracking.

The Innovation Proposed: Cryptographically proving fundraising progress without exposing individual contribution amounts - making privacy and transparency work together, and making sure the figures (not shown) are valid (using commitments generated).

Demo

🌐 Live Frontend: https://festfund.vercel.app/

📋 Note: The live demo showcases the complete UI/UX but smart contract features run locally via Hardhat to keep the project cost-free. Full blockchain functionality available in local development setup. Use hardhat blockchain to create wallets. Hence the deployed service [vercel frontend and koyeb backend] is ought to NOT work due to contracts not being deployed on real blockchain. It just serves as a high level skeleton for now - you have to run it locally for full experience.

🎥 Demo Videos (Both videos are same, kindly ignore my Voice speed sometimes and errors midway were resolved in few minutes but the part is cut to save time):

📂 GitHub Repository: ARYPROGRAMMER/FestFund

How I Used what I like about Midnight's Technology

Performance: Midnight Network reduced ZK proof generation from 418ms to 1ms - a 418x improvement.

Core Integration:

  • Midnight Testnet-02 RPC: Live ZK operations via https://rpc.testnet-02.midnight.network
  • Official SDK: @midnight-ntwrk/zswap package for cryptographic primitives
  • Dual Architecture: Automatic fallback between Midnight Network and self-hosted mode

High Level Architecture Diagram

Architecture Diagram High Level

Snippet for Implementation:

// Real Midnight Network integration
const zkProof = new ZKProofIntegration();
await zkProof.initialize("midnight-network");

// Generate private commitment (1ms with Midnight vs 418ms self-hosted)
const commitment = await zkProof.generateDonationCommitment(
  amount,
  donorSecret,
  eventId,
  minimumAmount
);
Enter fullscreen mode Exit fullscreen mode

Midnight's pre-optimized circuits and production infrastructure eliminated complex setup while providing enterprise-grade reliability and comprehensive documentation. Mine was using powersoftau (8) and it had the latency of 430ms (max) for same zkp. Midnight had 3 ms (max-rare) + is more secure as per my tests.

Screenshots of the Platform and Making / Debugging:

Architecture Diagram
Database
Campaign Details
Midnight ZKP Gen
Self ZKP Making
Restriction on Deploying for Now

Data Protection as a Core Feature

Privacy forms FestFund's foundational architecture through hardest encryption algorithms, guarantees:

🔒 Zero-Knowledge Privacy:

  • Individual donation amounts cryptographically hidden using ZK commitments.
  • Platform administrators cannot access raw donation data.
  • Nullifier protection prevents double-spending without revealing amounts (Controversial, in this case its allowed once per wallet address).

🏆 Transparent Accountability:

  • Public leaderboards show donor rankings without exposing amounts (Donor given a choice for this parameter while contributing).
  • Milestone progress verifiable through cryptographic proofs.
  • Campaign organizers receive aggregate data while preserving individual privacy.

Real-World Impact:

  • Enables private donations for sensitive causes (political, medical, controversial).
  • Maintains donor recognition through transparent rankings.
  • Ensures regulatory compliance via mathematically provable privacy.

Set Up Instructions / Tutorial

Prerequisites:

  • Node.js 18+, MongoDB, MetaMask wallet / Hardhat

Quick Start:

# Clone repository
git clone https://github.com/ARYPROGRAMMER/FestFund.git
cd FestFund

# Hardhat (new terminal, root dir, precompiled in github)
npx hardhat node
npm run deploy 

# Backend setup
cd backend && npm install && npm start
# ✅ Backend: http://localhost:3001

# Frontend setup (new terminal)
cd ../frontend && npm install && npm run dev
# ✅ Frontend: http://localhost:3000
Enter fullscreen mode Exit fullscreen mode

Environment Configuration [DEV]:

# 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
Enter fullscreen mode Exit fullscreen mode

Testing ZK Integration:

  1. Create campaign → Make private donation → Observe 1ms ZK proof generation
  2. Check leaderboard → See rankings without amount exposure
  3. Verify milestone achievements are cryptographically proven

Architecture: Next.js frontend, Express.js API, MongoDB persistence, Circom circuits with Midnight Network integration, Hardhat smart contracts.


Built with 💜 for the Midnight Network community - Arya Singh

More details / queries, email - arya.2023ug1104@iiitranchi.ac.in

Top comments (9)

Collapse
 
rohan_sharma profile image
Rohan Sharma

I need funding as well! Cool project

Collapse
 
aialok profile image
Alok Gupta

Love this man ❤️

Collapse
 
karthik_chowdari profile image
Karthik Chowdari

Really nice

Collapse
 
akshat_singh_18f084682e77 profile image
Akshat Singh

Nice

Collapse
 
dipuranjan_sethy_a8a8267a profile image
Dipuranjan Sethy

cool project and good work man

Collapse
 
deepanshu_gautam_9c36b043 profile image
Deepanshu Gautam

Cool project 😎

Collapse
 
narayan_thakur_fc120ad76c profile image
Narayan Thakur

Great. Really love it.

Collapse
 
kumaranubhav64 profile image
Kumar Anubhav

Cool

Collapse
 
anshu_kumar_4a8413f8dfae1 profile image
Anshu Kumar

Cool