An open API service indexing awesome lists of open source software.

https://github.com/aryprogrammer/festfund

Decentralized fundraising platform with Midnight Network integration enabling completely private donations while maintaining full transparency and accountability. Donors get public recognition while keeping donation amounts cryptographically private through dual ZK proof systems.
https://github.com/aryprogrammer/festfund

Last synced: 5 months ago
JSON representation

Decentralized fundraising platform with Midnight Network integration enabling completely private donations while maintaining full transparency and accountability. Donors get public recognition while keeping donation amounts cryptographically private through dual ZK proof systems.

Awesome Lists containing this project

README

          

# ๐ŸŒ™ FestFund - Privacy-First Fundraising

![Midnight Network](https://img.shields.io/badge/Midnight-ZKP-purple.svg)
[![Production Ready](https://img.shields.io/badge/Status-Local%20Working-brightgreen.svg)](#architecture)
[![Live Demo](https://img.shields.io/badge/Live%20Demo-festfund.vercel.app-blue.svg)](https://festfund.vercel.app/)
[![YouTube Demo](https://img.shields.io/badge/Demo-YouTube-red.svg)](https://www.youtube.com/watch?v=4dsZVYmTkkY)
[![Vimeo Demo](https://img.shields.io/badge/Technical%20Deep%20Dive-Vimeo-blue.svg)](https://vimeo.com/1116483249?share=copy)

**Tech Stack:**
![Next.js](https://img.shields.io/badge/Next.js-000000?style=flat&logo=next.js&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)
![Node.js](https://img.shields.io/badge/Node.js-43853D?style=flat&logo=node.js&logoColor=white)
![Express.js](https://img.shields.io/badge/Express.js-404D59?style=flat&logo=express&logoColor=white)
![MongoDB](https://img.shields.io/badge/MongoDB-4EA94B?style=flat&logo=mongodb&logoColor=white)
![Solidity](https://img.shields.io/badge/Solidity-363636?style=flat&logo=solidity&logoColor=white)
![Hardhat](https://img.shields.io/badge/Hardhat-FFF100?style=flat&logo=hardhat&logoColor=black)
![TailwindCSS](https://img.shields.io/badge/TailwindCSS-38B2AC?style=flat&logo=tailwind-css&logoColor=white)
![Vercel](https://img.shields.io/badge/Vercel-000000?style=flat&logo=vercel&logoColor=white)

*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

- **Insomnia Collection**: https://docs.midnight.network/develop/nodes-and-dapps/nodes-endpoints
- **Testnet-02 RPC**: `https://rpc.testnet-02.midnight.network`

**How I Used in FestFund:**

1. **ZK Proof Infrastructure** - Automatic fallback to self-hosted mode
2. **Privacy Primitives** - Built-in cryptographic operations work in both modes
3. **Wallet Integration** - Seamless user authentication (MetaMask)
4. **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**

```bash

# 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](screenshots/diagram.png)

![Privacy Restrictions](screenshots/restriction.png)

![Main Dashboard](screenshots/image.png)

![Database View](screenshots/db.png)

![Campaign Creation](screenshots/image2.png)

![Donation Interface](screenshots/image3.png)

![Leaderboard](screenshots/image4.png)

![Achievements](screenshots/image5.png)

![Analytics](screenshots/image6.png)

## **Architecture Diagram**

```mermaid
graph TB
%% Core Components (8 total)
USER[๐Ÿ‘ฅ Users & Donors]
FRONTEND[๐ŸŽจ Next.js Frontend
:3000]
BACKEND[โšก Express.js API
:3001]
DATABASE[(๐Ÿ’พ MongoDB
Database)]
BLOCKCHAIN[๐Ÿ”— Smart Contracts
Hardhat Network/Midnight Network]

%% ZK Infrastructure
ZK_LOCAL[๐Ÿ” Self-Hosted ZK
Circom + SnarkJS
418ms Proofs
]
MIDNIGHT[๐ŸŒ™ Midnight Network
Testnet-02
1ms ZK Proofs
โœ… Default Mode]

%% Privacy Layer
PRIVACY[๐Ÿ“Š Privacy Layer
Private Donations
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*