A decentralized voting platform built using Django, Web3.py, and Ethereum smart contracts. This platform allows users to register as voters and cast their votes in a secure, transparent, and decentralized manner.
- Decentralized Voting: Secure and transparent voting using Ethereum smart contracts.
- Voter Registration: Admin can register voters by their Ethereum addresses.
- Voting: Registered voters can cast their votes for candidates.
- Results: Retrieve the current vote counts for each candidate.
Before you begin, ensure you have the following installed on your machine:
- Python 3.8+
- Node.js and npm
- Ganache (for local Ethereum blockchain)
- Truffle (for deploying smart contracts)
- Clone the repository:
git clone https://github.com/theshahzaibc/VoterX-Decentralised-Voting-Application-using-Django.git
cd VoterX
- Set up Python environment:
python -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
pip install -r requirements.txt
- Start Ganache: Open Ganache and create a new workspace or quickstart a blockchain.
- Deploy the smart contracts:
truffle migrate --reset
-
Configure Django settings: Update the Django settings with the deployed contract address and ABI in
settings.py
. -
Run Django development server:
python manage.py runserver
The smart contracts are located in the VoteX/contracts
directory. The primary contract is Voting.sol
, which handles voter registration, voting, and tallying of votes.
Deployment
Smart contracts are deployed using Truffle. The deployment scripts are in the VoteX/migrations
directory.
Interacting with Smart Contracts
We use web3.py
to interact with the smart contracts from the Django backend. The contract ABI and address must be configured in contract.py
.
This project is licensed under the MIT License. See the LICENSE file for details.