Skip to content

harshcodesdev/MidOps

Repository files navigation

MIDOPS - Privacy-First Voting Platform

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.

🌟 Features

πŸ” Privacy-First Design

  • 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

πŸ—³οΈ Governance Features

  • 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

πŸ”— Lace Wallet Integration

  • 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

🎨 Professional UI/UX

  • 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

πŸ› οΈ Technology Stack

Frontend

  • 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

Blockchain Integration

  • 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

Key Dependencies

{
  "@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"
}

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn
  • Lace Wallet browser extension
  • Web3-compatible browser (Chrome, Firefox, Edge)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd midnight-governance-dapp
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:3000

Wallet Setup

  1. Install Lace Wallet

    • Download from the Chrome Web Store
    • Create or import a wallet
    • Switch to Midnight Testnet
  2. Connect to the dApp

    • Click "Connect Lace Wallet" in the application
    • Approve the connection request
    • Grant necessary permissions

πŸ“± Usage Guide

Creating Proposals

  1. Connect your wallet using the header button
  2. Navigate to "Create Proposal" tab
  3. Fill in the proposal details:
    • Title (minimum 10 characters)
    • Description (minimum 50 characters)
    • Category selection
    • Voting duration (1-30 days)
  4. Submit the proposal and confirm the transaction

Voting on Proposals

  1. Browse active proposals in the "Proposals" tab
  2. Review proposal details by clicking "Details"
  3. Cast your vote by clicking "For" or "Against"
  4. Confirm the transaction in your wallet
  5. Track transaction status in the bottom-right panel

Dashboard Features

  • 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

πŸ”’ Privacy Features

Zero-Knowledge Proofs

  • Vote choices are hidden using ZK-SNARKs
  • Only vote counts are publicly visible
  • Individual voting history remains private

Data Protection

  • Wallet addresses are truncated in the UI
  • Sensitive operations use cryptographic proofs
  • Private state is stored locally and encrypted

Transparency

  • All proposals are publicly visible
  • Vote counts are transparent and verifiable
  • Smart contract code is open source

πŸ—οΈ Architecture

Component Structure

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

State Management

  • Wallet Store: Connection status, user info, providers
  • Governance Store: Proposals, votes, transactions
  • Transaction Manager: Status tracking, error handling

Smart Contract Integration

  • Governance Contract: Proposal creation and voting
  • Transaction Manager: Transaction lifecycle management
  • Provider Factory: Midnight Network service providers

πŸ§ͺ Development

Available Scripts

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 checks

Environment Variables

NEXT_PUBLIC_NETWORK_ENV=testnet
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...

Testing

npm run test         # Run unit tests
npm run test:e2e     # Run end-to-end tests

🌐 Network Configuration

Testnet Settings

  • 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

Contract Addresses

  • Governance Contract: 0x1234567890abcdef1234567890abcdef12345678 (Demo)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Use consistent naming conventions
  • Add proper error handling
  • Include comprehensive comments
  • Test all wallet interactions

πŸ“„ License

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

πŸ”— Links

πŸ†˜ Support

Common Issues

"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

Getting Help


Built with ❀️ for the Midnight Network ecosystem

This application demonstrates the future of privacy-preserving governance, where transparency and privacy coexist in perfect harmony.

About

decentralized opinion platform for midnight hackathon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published