Skip to content

nel349/midnight-bank

Repository files navigation

Midnight Bank - Privacy-First Banking DApp

Midnight Bank

A zero-knowledge banking application built on Midnight demonstrating private transfers, encrypted balances, and selective disclosure.

🚀 Quick Start

# Install and build
npm install && npm run build

# Run locally (Recommended)
npm run bank-ui:local

Open http://localhost:5173 in Chrome with Lace Wallet set to "Undeployed" network.

🏦 Using the Application

The application runs on a local Midnight network and provides a complete banking experience with privacy-first principles.

To use Midnight Bank, you'll need:

  • Chrome browser with Midnight Lace Wallet installed
  • Lace Wallet configured for "Undeployed" network (local development mode)

💰 Features

Core Banking

  • Account Creation: Deploy your own private bank contract with customizable settings
  • Private Balances: Account balances remain encrypted and private to the account holder
  • Secure Transactions: Deposit/withdraw funds with PIN authentication and zero-knowledge proofs
  • Transaction History: View your private transaction history with real-time updates

Advanced Privacy Features

  • Authorization System: Zelle-like transfer permissions between trusted contacts
  • Encrypted Transfers: Send money with amounts hidden until claimed by recipients
  • Selective Disclosure: Prove account status or balance thresholds for compliance
  • Multi-Account Support: Single contract supporting multiple users efficiently

🏗️ Architecture

Smart Contract (bank-contract/)

  • Compact language smart contract with 12 circuits
  • Shared contract architecture supporting multiple users
  • Encrypted balance storage with PIN-based authentication
  • Zero-knowledge proofs for all operations

API Layer (bank-api/)

  • TypeScript API with RxJS reactive state management
  • Private state provider for local encrypted storage
  • Transaction handling with comprehensive error recovery

Frontend (bank-ui/)

  • React + Material-UI with dark/light themes
  • Wallet integration with Midnight Lace
  • Real-time updates via reactive observables

🛠️ Development

# Development mode with hot reload
npm run dev:local

# Run tests
npm test

# Type checking
npm run typecheck

# Build all packages
npm run build

📋 Available Scripts

Command Description
npm run bank-ui:local Build and start UI (local network)
npm run bank-ui:testnet Build and start UI (testnet)
npm run dev:local Development mode with hot reload (local)
npm run dev:testnet Development mode with hot reload (testnet)
npm run build Build all packages
npm run test Run all tests
npm run typecheck Type check all packages

🔧 Configuration

Network configs are in bank-ui/public/:

  • config.local.json - Local development
  • config.testnet.json - Midnight testnet

🧪 Test

# Run all tests
npm test

# Run contract tests
cd bank-contract && npm test

# Run API tests  
cd bank-api && npm test

# Run UI tests
cd bank-ui && npm test

📚 Learn More

🤝 Contributing

We welcome contributions to Midnight Bank! Please read our contributing guidelines and submit pull requests for any improvements.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • Midnight Network for the privacy-preserving blockchain infrastructure
  • Input Output Global for developing the Midnight ecosystem
  • The zero-knowledge cryptography community for advancing privacy technology

Built with ❤️ for financial privacy

About

A zero-knowledge banking application built on Midnight demonstrating private transfers, encrypted balances, and selective disclosure.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors