A decentralized governance platform built on Midnight Network, enabling secure and anonymous voting with zero-knowledge proofs. This application demonstrates the power of privacy-preserving blockchain technology for democratic decision-making.
- Zero-Knowledge Voting: Cast votes privately while maintaining result transparency
- Anonymous Proposals: Create proposals without revealing your identity
- Encrypted Communications: All sensitive data is protected by cryptographic proofs
- Proposal Creation: Submit detailed governance proposals with categories
- Democratic Voting: Fair and transparent voting mechanism
- Execution System: Automatic execution of passed proposals
- Activity Dashboard: Track your participation and community stats
- Seamless Connection: One-click wallet connection
- Transaction Management: Real-time transaction status tracking
- Error Handling: Comprehensive error messages and recovery options
- State Management: Persistent wallet state across sessions
- Modern Design: Clean, professional interface with consistent theming
- Responsive Layout: Works perfectly on desktop and mobile devices
- Smooth Animations: Framer Motion animations for enhanced user experience
- Accessibility: Built with accessibility best practices
- Next.js 14: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- Shadcn/ui: High-quality UI components
- Framer Motion: Smooth animations and transitions
- Zustand: Lightweight state management
- Midnight Network: Privacy-preserving blockchain platform
- Lace Wallet: Official Midnight Network wallet
- Compact Smart Contracts: Privacy-focused smart contract language
- Zero-Knowledge Proofs: Cryptographic privacy protection
{
"@midnight-ntwrk/dapp-connector-api": "^3.0.0",
"@midnight-ntwrk/wallet-api": "^5.0.0",
"@midnight-ntwrk/midnight-js-types": "^2.0.2",
"framer-motion": "latest",
"zustand": "latest",
"rxjs": "^7.8.2"
}- Node.js 18+ and npm/yarn
- Lace Wallet browser extension
- Web3-compatible browser (Chrome, Firefox, Edge)
-
Clone the repository
git clone <repository-url> cd midnight-governance-dapp
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
-
Install Lace Wallet
- Download from the Chrome Web Store
- Create or import a wallet
- Switch to Midnight Testnet
-
Connect to the dApp
- Click "Connect Lace Wallet" in the application
- Approve the connection request
- Grant necessary permissions
- Connect your wallet using the header button
- Navigate to "Create Proposal" tab
- Fill in the proposal details:
- Title (minimum 10 characters)
- Description (minimum 50 characters)
- Category selection
- Voting duration (1-30 days)
- Submit the proposal and confirm the transaction
- Browse active proposals in the "Proposals" tab
- Review proposal details by clicking "Details"
- Cast your vote by clicking "For" or "Against"
- Confirm the transaction in your wallet
- Track transaction status in the bottom-right panel
- Statistics Overview: View community participation metrics
- Your Activity: Track your votes and proposals
- Recent Activity: See latest governance actions
- Privacy Notice: Understand how your data is protected
- Vote choices are hidden using ZK-SNARKs
- Only vote counts are publicly visible
- Individual voting history remains private
- Wallet addresses are truncated in the UI
- Sensitive operations use cryptographic proofs
- Private state is stored locally and encrypted
- All proposals are publicly visible
- Vote counts are transparent and verifiable
- Smart contract code is open source
src/
βββ components/
β βββ wallet/ # Wallet connection components
β βββ governance/ # Proposal and voting components
β βββ dashboard/ # Statistics and overview
β βββ transactions/ # Transaction status tracking
β βββ layout/ # Header, footer, navigation
βββ lib/
β βββ wallet/ # Wallet integration logic
β βββ contracts/ # Smart contract interfaces
β βββ store/ # State management
βββ app/ # Next.js app router pages
- Wallet Store: Connection status, user info, providers
- Governance Store: Proposals, votes, transactions
- Transaction Manager: Status tracking, error handling
- Governance Contract: Proposal creation and voting
- Transaction Manager: Transaction lifecycle management
- Provider Factory: Midnight Network service providers
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript checksNEXT_PUBLIC_NETWORK_ENV=testnet
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...npm run test # Run unit tests
npm run test:e2e # Run end-to-end tests- Indexer:
https://indexer.testnet-02.midnight.network/api/v1/graphql - RPC Node:
https://rpc.testnet-02.midnight.network - Proof Server:
https://lace-dev.proof-pub.stg.midnight.tools
- Governance Contract:
0x1234567890abcdef1234567890abcdef12345678(Demo)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use consistent naming conventions
- Add proper error handling
- Include comprehensive comments
- Test all wallet interactions
This project is licensed under the MIT License - see the LICENSE file for details.
"Could not find Midnight Lace wallet"
- Ensure the Lace wallet extension is installed and enabled
- Refresh the page after installation
"Incompatible version"
- Update your Lace wallet extension to the latest version
"Transaction failed"
- Check your wallet balance for transaction fees
- Verify network connectivity
- Try again after a few moments
- Check the documentation
- Join the Discord community
- Open an issue on GitHub
Built with β€οΈ for the Midnight Network ecosystem
This application demonstrates the future of privacy-preserving governance, where transparency and privacy coexist in perfect harmony.