This repository contains a simple voting application built with Solidity, a programming language for smart contracts on the Ethereum blockchain.
This application allows users to:
- Create a ballot: A user can create a ballot with a title, description, and list of options or candidates.
- Set voting period: The user can specify a start and end date and time for the voting period.
- Vote: Any user can cast their vote for one option or candidate in a ballot.
- View results: Once the voting period is over, anyone can view the total votes for each option and the winner(s) based on the election rules.
- Transparency: All votes are stored on the Ethereum blockchain, ensuring transparency and immutability.
- Security: Votes are encrypted and cannot be tampered with.
- Accessibility: Anyone with an Ethereum wallet can participate in the voting process.
- Auditability: The voting process is auditable by anyone, increasing trust and accountability.
- Solidity: Programming language for smart contracts on the Ethereum blockchain.
- Hardhat: Development environment for building, testing, and deploying smart contracts.
- OpenZeppelin Contracts: Library of secure and tested smart contract components.
You must have Node.js and NPM installed on your system. You should have some understanding of Solidity and smart contracts.
- Clone this repository to your local machine.
- Open a terminal window and navigate to the project directory.
- Install the required dependencies by running npm install.
npm install
- Compile the smart contracts by running npx hardhat compile.
npx hardhat compile
- Deploy the smart contracts to a testnet by running npx hardhat run scripts/deploy.js.
npx hardhat run --network sepolia scripts/deploy.js
- Once the contract is uploaded to the blockchain, copy the contract address and copy it in the .env file. You can also use another blockchain by writing the blockchain's endpoint in hardhat-config.
*Once you have pasted your private key and contract address in the .env file, simply run command
npm start
- You can test the smart contracts using Mocha and Chai.
- Run the tests by running npx hardhat test.
You can interact with the smart contracts using a web3 library like Web3.js or Metamask. Refer to the contract documentation for more information on how to interact with the specific functions.
- Solidity Documentation: https://docs.soliditylang.org/
- Hardhat Documentation: https://hardhat.org/hardhat-runner/docs/getting-started
- OpenZeppelin Contracts Documentation: https://docs.openzeppelin.com/contracts/3.x/
- Ethereum Voting App Tutorial: https://dapp.vote/
- Guide to Developing an Ethereum Decentralized Voting Application: https://www.freecodecamp.org/news/developing-an-ethereum-decentralized-voting-application-a99de24992d9/
- Enhanced Features: Weighted voting, ranked-choice voting, multi-signature voting, voter verification, secret ballots, proposal voting.
- Scalability and Performance: Off-chain voting, sharding, zero-knowledge proofs.
- Integration and Interoperability: Decentralized Identity, Decentralized Autonomous Organizations, cross-chain voting.
- Security and Privacy: Formal verification, bug bounty programs, privacy-enhancing technologies.
- User Experience: User-friendly interface, mobile application, accessibility features.