The ArtemisZkVoting
smart contract is designed for decentralized autonomous organization (DAO) voting. It leverages the Ethereum blockchain and integrates advanced cryptographic techniques like zk-SNARKs for privacy and Merkle proofs for data integrity.
- Proposal Management: Ability to add proposals for voting, including description, duration, quorum, and other parameters.
- zk-SNARKs Verification: Ensures the integrity and privacy of votes through zero-knowledge proofs.
- Merkle Proof Verification: Validates voter eligibility without revealing voter identities.
- Pause/Resume Voting: Contract owner can pause and resume voting, enhancing control during emergencies or system maintenance.
- Ownership Management: Allows for the transfer of contract ownership for administrative flexibility.
- Solidity ^0.8.20
- OpenZeppelin Contracts (for cryptography and access control)
- Ensure you have a development environment for Ethereum smart contracts, like Hardhat.
yarn install
- Install OpenZeppelin contracts:
npm install @openzeppelin/contracts
- Deploy the contract to an Ethereum network using your preferred method (e.g., Hardhat deploy scripts).
Deploy the contract by specifying the initial owner's address:
ArtemisZkVoting ArtemisZkVoting = new ArtemisZkVoting(initialOwnerAddress);
The contract owner can add a proposal:
ArtemisZkVoting.addProposal(description, merkleRoot, duration, quorum, passcodeHash);
Voters can vote on active proposals using zk-SNARKs proofs and Merkle proofs:
ArtemisZkVoting.voteForProposal(proposalId, support, merkleProof, leaf, proof);
A proposal's voting period can be ended, triggering the vote tally:
ArtemisZkVoting.endVoting(proposalId);
The contract owner can pause and resume voting:
ArtemisZkVoting.pauseVoting();
ArtemisZkVoting.resumeVoting();
Ownership can be transferred to a new owner:
ArtemisZkVoting.transferContractOwnership(newOwnerAddress);
Write tests for each function to ensure the contract behaves as expected. You can use Hardhat for testing Solidity contracts.
yarn test
This contract uses OpenZeppelin’s libraries for secure contract development. Regular audits and reviews are recommended to maintain security standards.
This project is licensed under the GPL-3.0 license.