This project implements a zero-knowledge proof circuit using the Noir programming language, designed for secure and anonymous voting on a blockchain ๐. The circuit ensures that votes are counted without revealing the identity of the voters, leveraging cryptographic techniques to maintain privacy and integrity ๐.
- Anonymity ๐ญ: Ensures voter anonymity using zero-knowledge proofs.
- Security ๐: Utilizes the
ecrecover
library for secure ECDSA signature recovery. - Efficiency โก: Supports up to 64 votes in a single transaction, optimized for gas efficiency.
- Verifiability โ : Each vote is verifiable without compromising voter privacy.
- Rust programming language ๐ฆ
- Noir Compiler ๐ฅ๏ธ
main
: The main function that executes the zero-knowledge proof, verifying votes ๐ณ๏ธ.test_main
: A test function that demonstrates how to call the main function with sample data ๐งช.
chain_id
: Blockchain identifier ๐proposal_id
: On-chain proposal ID ๐num_votes
: Number of votes ๐vote
: Array indicating votes (1 for yes, 0 for no) ๐๐pub_key_x
,pub_key_y
: Public key coordinates for ECDSA ๐signature
: Signatures corresponding to each vote ๐๏ธhashed_message
: Hashed messages that correspond to each vote ๐index
,hashpath
: Merkle proof components ๐ฒroot
: Merkle root for validation ๐
- Compilation: Compile the circuit using the Noir compiler ๐ ๏ธ.
- Deployment: Deploy the compiled circuit to your preferred blockchain platform ๐ค.
- Execution: Execute the circuit by passing the required parameters (as demonstrated in
test_main
) ๐โโ๏ธ.
nargo test
: Run the test suite to ensure the circuit is functioning as expected.
nargo check
: Build circuit constraints system and check for errors and warnings.
nargo prove
: Generate a proof for the circuit using the specified parameters.
nargo verify
: Verify a proof for the circuit using the specified parameters.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements ๐จโ๐ป๐ฉโ๐ป.