{"id":36684788,"url":"https://github.com/vitwit/cosmos-zk-gov","last_synced_at":"2026-01-12T11:11:56.473Z","repository":{"id":245280905,"uuid":"817755817","full_name":"vitwit/cosmos-zk-gov","owner":"vitwit","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-09T15:03:02.000Z","size":211,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-09T16:19:35.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitwit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-20T11:26:34.000Z","updated_at":"2024-12-09T15:03:15.000Z","dependencies_parsed_at":"2024-06-21T04:36:13.950Z","dependency_job_id":"1821aa10-7b51-4812-b893-07e36675ce8f","html_url":"https://github.com/vitwit/cosmos-zk-gov","commit_stats":null,"previous_names":["vitwit/zk-anon-voting","vitwit/cosmos-zk-gov"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vitwit/cosmos-zk-gov","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcosmos-zk-gov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcosmos-zk-gov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcosmos-zk-gov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcosmos-zk-gov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitwit","download_url":"https://codeload.github.com/vitwit/cosmos-zk-gov/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcosmos-zk-gov/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-12T11:11:53.161Z","updated_at":"2026-01-12T11:11:56.457Z","avatar_url":"https://github.com/vitwit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Cosmos ZK Voting**\n\nA secure and anonymous governance voting system leveraging Zero-Knowledge (ZK) proofs on the Cosmos blockchain.\n\n## **Overview**\n\nCosmos ZK Voting is a governance voting system designed to ensure voter anonymity while maintaining the integrity and security of the voting process. Utilizing Zero-Knowledge proofs, this system allows voters to participate in governance without revealing their identities, fostering a more private and secure voting environment.\n\n## **Features**\n\n* **Anonymous Voting:** Protects voter identities using Zero-Knowledge proofs.  \n* **Decentralized:** Built on the Cosmos blockchain for enhanced security and scalability.  \n* **Secure Key Management:** Ensures the safety of prover and verifier keys.  \n* **dispatcher Support:** Facilitates seamless vote transactions through a dedicated dispatcher service.  \n* **Flexible Proposal Management:** Create and manage governance proposals with ease.\n\n## **Getting Started**\n\nFollow the steps below to set up and run Cosmos ZK Voting locally.\n\n### **Prerequisites**\n\n* [Go](https://golang.org/doc/install) (version 1.18 or higher)  \n* Cosmos SDK installed  \n* [Git](https://git-scm.com/downloads)\n\n### **Clone the Repository**\n\n```bash\n\ngit clone https://github.com/vitwit/cosmos-zk-gov\n\ngit fetch\n\ngit checkout main\n```\n\n### **Install zkappd  Binary**\n\nBuild and install the `zkappd ` binary required to run the Cosmos ZK Voting chain.\n\n```bash\nmake install\n```\n\n### **Run Local Testnet**\n\nInitialize and start a local testnet.\n\n1. **Initialize and Start the Chain:**  \nModify the `scripts/init-zkgovapp.sh` script according to your requirements.  \n`make init-zkgovapp` will the run chain.\n```bash   \nmake init-zkgovapp\n```\n\n\n## **ZK Prover and Verifier Keys**\n\nBefore setting up the chain, generate the ZK prover and verifier keys.\n\n**Create Keys Directory:**  \n```bash\nmkdir keys\n```\n\n1. **Generate ZK Keys:**  \n```bash\nmake generate-zk-keys\n```\n\n2. This command runs the `groth16.setup()` function defined in `/x/zkgov/client/zk/main.go`.  \n   **Note:** Multiple prover and verifier key pairs are generated (e.g., `verifier-2`, `verifier-3`, `verifier-4`, etc.) to accommodate varying Merkle proof sizes. Use the appropriate key pair dynamically as needed.\n\n### **Future Enhancements**\n\n* **Optimize Merkle Implementation:** Aim for a constant Merkle tree size of 2^31 and improve update operations from O(n) to O(log n).\n\n## **Dispatcher**\n\nThe Dispatcher is an HTTP server that listens for vote transactions, signs them with a valid chain address, and broadcasts them on-chain.\n\n### **Why Use a Dispatcher?**\n\nVote transactions must be sent from a different, unlinkable address than the registered address. Since most users may not have multiple unlinkable addresses, the dispatcher serves as an intermediary to handle this securely.\n\n**Security Assurance:** The Dispatcher cannot manipulate transactions because the ZK proof guarantees transaction validity without exposing user secrets.\n\n### **Running the Dispatcher**\n1.**Start the dispatcher:**  \n```bash  \nzkappd  tx zk-gov run-dispatcher --from {key} --keyring-backend test --chain-id {chain-id} -y\n```\n\nAlternatively, you can run a predefined dispatcher (e.g., alice):  \n```bash  \nmake run-alice-dispatcher\n```\n\n2. This command starts an HTTP server on port `8080` by default. You can change the port using the `--dispatcherPort {port}` flag.\n\n## **Transactions**\n\n### **Create a Proposal**\n\nCreate a new governance proposal that can be voted on with a YES or NO.\n\n**Note:** This implementation is basic and intended for testing. A more robust system is recommended for production use.\n\n**Proposal ID:** Starts at 1 and increments sequentially.\n\n```bash\nzkappd  tx zk-gov create-proposal [proposal-title] [proposal-description] --from [address] --keyring-backend test --chain-id [chain-id]\n```\n\nOr use a make command for convenience:\n\n```bash\nmake create-proposal-a\n```\n\n**Create Commitments Directory:**  \n```bash  \nmkdir commitments\n```\n\n\n### **Register a Vote**\n\nRegister a vote commitment, which will be used later to anonymize the actual vote.\n\n```bash\nzkappd  tx zk-gov register-vote [proposal-id] {\"YES\"/\"NO\"} --from [actual-voter-address] --keyring-backend test --chain-id [chain-id]\n```\n\nAlternatively, use predefined make commands:\n\n```bash\nmake register-alice-vote\n\nmake register-bob-vote\n\nmake register-charlie-vote\n\nmake register-david-vote\n```\n\n### **Cast a Vote**\n\nAfter registering a vote commitment, generate a ZK proof to cast the actual vote. This proof verifies that you know the valid commitment without revealing your identity.\n\n**Important:** The vote transaction must be signed by a different, unlinkable address from the one used to register the vote commitment. Use the dispatcher to facilitate this process.\n\n#### **Without dispatcher**\n\n```bash\nzkappd  tx zk-gov vote [proposal-id] [register-vote-address] --from [different-unlinkable-address] --keyring-backend test --chain-id [chain-id]\n```\n\nOr use make commands:\n\n```bash\nmake broadcast-alice-vote\nmake broadcast-bob-vote\n```\n\n#### **With Dispatcher**\n\n```bash\nzkappd  tx zk-gov vote [proposal-id] [register-vote-address] --dispatcher [dispatcher-address]\n```\n\nOr use make commands:\n\n```bash\nmake broadcast-charlie-vote-via-dispatcher\n\nmake broadcast-david-vote-via-dispatcher\n```\n\n### **Query a Proposal**\n\nView the state of a proposal, including commitments and votes.\n\n```bash\nzkappd  q zk-gov get-proposal-info [proposal-id]\n```\n\n## **Contributing**\n\nContributions are welcome\\! Please fork the repository and submit a pull request for any enhancements or bug fixes.\n\n## **License**\n\nThis project is licensed under the MIT License.\n\n## **Contact**\n\nFor questions or support, please open an issue on the [GitHub repository](https://github.com/vitwit/cosmos-zk-voting) or reach out to contact@vitwit.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitwit%2Fcosmos-zk-gov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitwit%2Fcosmos-zk-gov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitwit%2Fcosmos-zk-gov/lists"}