@thinhdang1402/zk-voting
v1.0.1
Published
A Zero-Knowledge Voting protocol for EVM-compatible blockchains
Downloads
9
Maintainers
Readme
@thinhdang1402/zk-voting
A Zero-Knowledge Voting protocol for EVM-compatible blockchains. This package provides cryptographic primitives and utilities for implementing secure, private voting systems using zero-knowledge proofs and Merkle trees.
Features
- Zero-Knowledge Voting: Implement private voting without revealing individual votes
- Merkle Tree Integration: Efficient proof generation and verification
- EVM Compatible: Works with Ethereum and other EVM-compatible blockchains
- TypeScript Support: Full TypeScript definitions included
- Cryptographic Security: Built on proven cryptographic primitives
Installation
npm install @thinhdang1402/zk-voting
# or
yarn add @thinhdang1402/zk-votingUsage
import { ZKVoting, MerkleDistributor } from '@thinhdang1402/zk-voting'
// Initialize the voting system
const voting = new ZKVoting()
// Create a Merkle tree for voter distribution
const distributor = new MerkleDistributor(voters)
// Generate proofs and cast votes
const proof = distributor.generateProof(voter)
const vote = voting.castVote(proof, choice)API Documentation
Core Classes
ZKVoting: Main voting protocol implementationMerkleDistributor: Merkle tree management for voter distributionLeaf: Individual voter leaf nodeNode: Merkle tree node structure
Types
Vote: Vote data structureProof: Zero-knowledge proof structureMerkleProof: Merkle tree proof
Development
# Install dependencies
yarn install
# Build the package
yarn build
# Run tests
yarn test:lib
yarn test:contract
# Generate documentation
yarn docsLicense
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
