Welcome to the future of voting! This blog will walk you through the development and operation of an Aadhaar-based voting system that harnesses the strength of blockchain technology. Implemented as part of the Rajasthan Hackathon, this project aims to ensure secure and reliable voting for everyone.
How It Works
Think of the Aadhaar voting system as a high-security bank vault, where only authorized individuals can access their accounts and perform transactions. The whole idea is to ensure that only eligible voters can cast their votes safely and accurately. Here’s how the process works:
- The authority logs in first using a session ID — like a bank manager checking access credentials.
- Voters authenticate themselves using a One-Time Password (OTP) sent to their registered mobile number. This is crucial for verifying their identity, just like a bank sends an OTP before allowing a transaction.
- Once validation is complete, the system verifies the voter’s age and registered address, ensuring that they are eligible to vote.
- The voting palette pops up with candidate names, their corresponding parties, and logos, similar to a voting screen displaying options.
- Voters can cast their votes with a simple click of the “vote” button — just like signing a check in a bank.
- Once a vote is cast, the voting buttons are disabled to prevent multiple votes, ensuring integrity in the voting process.
Installing and Running the Project
Let’s dig into how you can set up and run this exciting project on your local machine!
Clone the Project
git clone git@github.com:sanattaoritechdot.git
cd techdot
Install Dependencies
npm install
Running the Project
Once dependencies are installed, it’s time to get the project running. Use the command:
node index.js
Troubleshooting
If you encounter a dependency problem, delete the package.json
file, run:
npm init
Then reinstall dependencies and rerun the project.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Running the Project
Step 1: Setting up the Environment
Using an in-memory blockchain (akin to a simulated environment) known as tesrpc makes testing quick and easy:
npm install ethereumjs-testrpc web3
Step 2: Creating a Voting Smart Contract
Next, you’ll want to install the Solidity compiler and replace your Aadhaar number and phone number in the specified file:
npm install solc
Locate the necessary lines in the code base to fill in your Aadhaar details. The path to do this is found here: app.js.
Step 3: Testing in Node Console
Although optional, testing your smart contract in Node.js is a good practice:
node
Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
Make sure Web3.js is properly initialized and can retrieve accounts from the blockchain:
web3.eth.accounts
Step 4: Interacting with the Contract via Node.js Console
After deploying your smart contract, you can interact with it using the command:
contractInstance.totalVotesFor.call(Sanat).toLocaleString()
Common Issues & Solutions
If you face the “TypeError: Cannot read property ‘:Voting’ of undefined” error:
- Ensure you have
ganache-cli
installed: - Copy the address of your first account from Ganache, and paste it to the specified line in clist.js.
sudo npm install ganache-cli -g
Purpose of the Project
The Aadhaar-based voting system aims to enhance security by:
- Ensuring only authorized individuals can log in, preventing fraud.
- Authenticating users with OTP linked to Aadhaar for added security.
- Disabling voting buttons post-selection to curb multiple voting attempts.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.