Status: Proof-of-Concept (PoC) | Proposed For: Project Catalyst - Midnight Compact DApps | License: Apache 2.0
The Merito Compact DApp is a foundational open-source framework designed to solve the critical challenges of plutocracy and Sybil attacks in decentralized governance.
Merito enables merit-based (shāyesteh-sālārī) voting by leveraging Midnight's Private State and ZK-proofs to allow users to privately prove their expertise (via Verifiable Credentials) and unique identity, ensuring vote weight is determined by verifiable qualifications, not token holdings.
- Privacy-Preserving Sybil Resistance: Implements a mechanism to link multiple DIDs to a single, verified identity, storing the linkage hash securely in the Private State.
-
Selective Disclosure for Merit: Generates Zero-Knowledge Proofs (ZKPs) to prove a user possesses the required VCs and calculate their weighted vote score (
$W$ ), without revealing the sensitive credentials themselves. - Reusable Tooling: Provides the definitive reference architecture for combining ZK logic, Compact Contracts, and the TypeScript ecosystem on Midnight.
The DApp is composed of three interconnected, modular repositories:
| Component | Technology | Role |
|---|---|---|
| MeritoWeightingEngine | Compact Language (Rust) | The auditable, on-chain contract that verifies the ZKP and updates the vote tally. Does not access private data. |
| TypeScript SDK | TypeScript/JavaScript | The local engine responsible for reading VCs, running the ZK circuit, and generating the proof of eligibility and weight. |
| PoC UI | TypeScript/React | The user interface demonstrating the private identity linking, VC upload, and transaction submission flow. |
To run the full Proof-of-Concept locally, you must have the required Midnight SDK and tooling installed.
- Node.js (LTS version)
- Yarn or npm
- Midnight SDK/Toolchain (refer to official documentation)
# Clone the repository
git clone https://github.com/YourRepo/merito-compact-dapp.git
cd merito-compact-dapp
# 1. Setup Compact Contract environment
cd compact
cargo build # Ensure the contract compiles
# 2. Setup TypeScript SDK and UI (Dependencies are shared)
cd ../sdk-ts
npm install This command starts the local web interface for demonstration purposes.
npm run start:pocValidation of the Merito DApp is focused on the correctness of the ZK logic and contract verification.
| Component | Purpose | Command |
|---|---|---|
| Compact Contract | Ensure the verify_and_cast_vote function correctly accepts valid ZK proofs and rejects invalid/tampered proofs. |
cd compact && cargo test --package merito_contract |
| TypeScript SDK | Verify the SDK reliably generates the required ZKP and calculates the correct weighted score ( |
cd sdk-ts && npm test --suite=proof_generation |
Developers are encouraged to reuse and extend the core components:
- Custom Governance Logic: Modify the Meritocratic Weighting Formula within the
MeritoWeightingEngine.compactsource code. - Private Identity: Reuse the Private Identity Linking pattern demonstrated in the SDK for any DApp requiring Sybil-resistant user access.
- SDK Integration: Integrate the
merito_sdk.proof.generateMeritProof()API into any external DAO front-end.
| Name | Role | Profile Link |
|---|---|---|
| Omid Ajourlou | Software Architect & Project Lead | |
| Sadegh Ghoroghi | Software Engineer |
This project is released under the Apache 2.0 License. See the LICENSE file for details.