A decentralized voting system built on the Ethereum blockchain, allowing users to create and participate in secure, transparent, and tamper-proof polls.
-
Create polls with a title, IPFS hash for poll details, and a specified number of options
-
Vote in existing polls using unique poll IDs and option indexes
-
Store votes immutably on the Ethereum blockchain
-
Maintain transparency and security throughout the voting process
-
Protect user privacy using decentralized identifiers (DIDs)
contracts/VotingSystem.sol: This Solidity file contains the smart contract code for the decentralized voting system. The contract manages poll creation, voting, and vote storage on the Ethereum blockchain.
migrations/1_initial_migration.js: This migration file, generated by Truffle, deploys the Migrations contract. The Migrations contract helps keep track of the migration state when deploying smart contracts.
migrations/2_deploy_contracts.js: This migration file deploys the VotingSystem smart contract to the specified Ethereum network. It imports the smart contract and uses Truffle's deployer.deploy() method to deploy it.
src/index.html: The main HTML file containing the structure and layout of the frontend application. It includes forms for creating polls and voting, as well as script tags to load the app.js file.
src/js/app.js: This JavaScript file handles the frontend logic for interacting with the Ethereum blockchain and the VotingSystem smart contract. It uses web3.js to connect to the Ethereum network, create polls, and submit votes.
truffle-config.js: This configuration file sets up the development environment and networks for the Truffle project. It specifies details such as the Ethereum network to deploy to, the Solidity compiler version, and other settings.
package.json: The Node.js package file containing metadata about the project and its dependencies.
build/: This directory is generated by Truffle when you compile your smart contracts. It contains the compiled contract JSON files, which include the contract ABI and other metadata.
- Node.js
- Truffle (npm install -g truffle)
- A local Ethereum development environment, such as Ganache
- An Ethereum wallet with mnemonic, such as MetaMask