voting-dapp is a decentralized application (DApp) that allows users to vote securely on a blockchain network. This project is built using Solidity for smart contracts and integrates with a web-based frontend for user interaction.
- Smart contract-based voting system
- Secure and tamper-proof votes
- Web3 integration for interacting with the blockchain
- Simple and user-friendly interface
- Smart Contracts: Solidity
- Frontend: JavaScript, HTML, CSS, Bootstrap, and React
- Blockchain Interaction: Web3.js
- Development Environment: Hardhat/Truffle
Ensure you have the following installed:
- Clone the repository:
git clone https://github.com/dappteacher/voting-dapp.git cd voting-dapp - Install dependencies:
npm install
- Compile the smart contracts:
npx hardhat compile
- Test the smart contracts:
npx hardhat test - Deploy the contracts on Sepolia and replace the values based on "Configuration":
npx hardhat run scripts/deploy.js --network sepolia
- Start the development server:
cd frontend npm install npm start
Before running the application, update the contract address and Infura endpoint in the appropriate files:
-
Smart Contract Address:
Replace your deployed contract address in the frontend config (e.g.,src/App.jsand.envfile):const CONTRACT_ADDRESS = "YOUR_CONTRACT_ADDRESS";
-
Infura Endpoint:
Update the Infura API URL in your environment file (.env):INFURA_API_URL=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID
Note: Replace "YOUR_CONTRACT_ADDRESS" and "YOUR_INFURA_PROJECT_ID" with your own values.
- Connect your MetaMask wallet.
- Select or add a voting option.
- Submit your vote securely on the blockchain.
- View the live vote count.
Contributions are welcome! Please fork the repository, make changes, and submit a pull request.
This project is licensed under the MIT License.
- Medium: https://medium.com/@dappteacher
- LinkedIn : https://www.linkedin.com/in/dappteacher
- GitHub : https://www.github.com/dappteacher