Giter VIP home page Giter VIP logo

techdot's Introduction

Aadhaar Voting

Aadhaar Based voting system using blockchain technology Project implemented as part of Rajasthan Hackathron

Description

  • The authority must login first with the provided session ID.
  • The voter can now begin the process of voting with proper authentication through OTP(one time password) on the respective linked mobile number.
  • If the voter is valid then the system will check for for the voters age and the address to which he can give vote.
  • the voting pallete will be opned with candidate names,their parties and logos.
  • Now the voter can give his vote by clicking vote button.
  • one voter can give his vote only once,i.e after one time voting buttons are disabled and the vote is automatically loged out.
  • Same process continiues for many more votters irrespective of their voting wards.

Installing and Running Project

Clone Project

git clone [email protected]:sanattaori/techdot.git && cd techdot

Install Dependencies

npm install

Running Project

node index.js

If dependency problem occurs delete package.json, Run

npm init

Again Install dependencies and run project.

Running Project

Step 1 - Setting up Environment Instead of developing the app against the live Ethereum blockchain, we have used an in-memory blockchain (think of it as a blockchain simulator) called testrpc.

npm install ethereumjs-testrpc web3

Step 2 - Creating Voting Smart Contract

npm install solc

Replace your aadhaar no and phone number for running project at

"<replace your aadhaar no here>": "<your phone number>",

Step 3 - Testing in node console

Not required just for testing in node console- After writing our smart contract, we'll use Web3js to deploy our app and interact with it

$ node
> Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
Then ensure Web3js is initalized and can query all accounts on the blockchain

> web3.eth.accounts
Lastly, compile the contract by loading the code from Voting.sol in to a string variable and compiling it

> code = fs.readFileSync('Voting.sol').toString()
> solc = require('solc')
> compiledCode = solc.compile(code)

testrpc creates 10 test accounts to play with automatically. These accounts come preloaded with 100 (fake) ethers.

Deploy the contract!

dCode.contracts[‘:Voting’].bytecode: bytecode which will be deployed to the blockchain. compiledCode.contracts[‘:Voting’].interface: interface of the contract (called abi) which tells the contract user what methods are available in the contract.

> abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface)
> VotingContract = web3.eth.contract(abiDefinition)
> byteCode = compiledCode.contracts[':Voting'].bytecode
>deployedContract = VotingContract.new(['Sanat','Aniket','Mandar','Akshay'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
> deployedContract.address
> contractInstance = VotingContract.at(deployedContract.address)
deployedContract.address. When you have to interact with your contract, you need this deployed address and abi definition we talked about earlier.

Step 4 - Interacting with the Contract via the Nodejs Console

> contractInstance.totalVotesFor.call('Sanat').toLocaleString()
'2'

For TypeError: Cannot read property ':Voting' of undefined :

Make sure you have ganache-cli

sudo npm install ganache-cli -g

copy address of first account

$ ganache-cli

Paste this adderess to ui/js/clist.js line 17

contractInstance = VotingContract.at('0xa7fb89a3fe6927b6d272637b148775f6fee5a8cf');

Purpose of test

  • The authority login is to ensure security to prevent piracy,harresment and corruption from candidates standing in election.
  • OTP generation is to authenticate the right aadhar card owner.
  • button disabling and automatic logout is to prevent multiple voting by single candidate.

Screenshots

Deployment

The Aadhaar based voting system is developed to overcome the flaws of EVM system. So directly EVM will be replaced by touch screen interface having the great user interface and high security.

Authors

  • Sanat Taori
  • Akshay Motghare
  • Mandar Patil
  • Aniket Narkhede

License

This project is licensed under the MIT License - see the LICENSE file for details

techdot's People

Contributors

9511738743 avatar akshaymotghare avatar sanattaori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

techdot's Issues

JSON RPC Error after Submitting OTP

Error: Invalid JSON RPC response: undefined
at Object.InvalidResponse (/home/anil/techdott/node_modules/web3/lib/web3/errors.js:38:16)
at HttpProvider.send (/home/anil/techdott/node_modules/web3/lib/web3/httpprovider.js:91:22)
at RequestManager.send (/home/anil/techdott/node_modules/web3/lib/web3/requestmanager.js:58:32)
at Eth.get [as accounts] (/home/anil/techdott/node_modules/web3/lib/web3/property.js:107:62)
at /home/anil/techdott/index.js:96:111
at Layer.handle [as handle_request] (/home/anil/techdott/node_modules/express/lib/router/layer.js:95:5)
at next (/home/anil/techdott/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/anil/techdott/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/anil/techdott/node_modules/express/lib/router/layer.js:95:5)
at /home/anil/techdott/node_modules/express/lib/router/index.js:281:22

yargs-parser Vulnerable to Prototype Pollution

yargs-parser Vulnerable to Prototype Pollution
'{"errors":[{"component":"general","formattedMessage":"* Line 1, Column 1\n Syntax error: value, object or array expected.\n* Line 1, Column 2\n Extra non-whitespace after JSON value.\n","message":"* Line 1, Column 1\n Syntax error: value, object or array expected.\n* Line 1, Column 2\n Extra non-whitespace after JSON value.\n","severity":"error","type":"JSONError"}]}'

Project is not running

I have tried the steps, but it's not working and showing many errors. Can you provide a video on how to set up this project?

facing issue while setup firebase in the project

i added all the fields after setting up firebase as you mentioned in app.htmll#16 but it didn't run the project. and also after login it gives error

Error: cannot convert string value "6060604052341561000c57fe5b6040516103d83803806103d8833981016040528080518201919050505b806001908051906020019061003f929190610047565b505b506100bf565b828054828255906000526020600020908101928215610089579160200282015b82811115610088578251829060001916905591602001919060010190610067565b5b509050610096919061009a565b5090565b6100bc91905b808211156100b85760008160009055506001016100a0565b5090565b90565b61030a806100ce6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f265cf714610067578063392e6678146100a55780637021939f146100e1578063b13c744b1461011f578063cc9ab2671461015b575bfe5b341561006f57fe5b61008960048080356000191690602001909190505061017f565b604051808260ff1660ff16815260200191505060405180910390f35b34156100ad57fe5b6100c76004808035600019169060200190919050506101cd565b604051808215151515815260200191505060405180910390f35b34156100e957fe5b610103600480803560001916906020019091905050610233565b604051808260ff1660ff16815260200191505060405180910390f35b341561012757fe5b61013d6004808035906020019091905050610253565b60405180826000191660001916815260200191505060405180910390f35b341561016357fe5b61017d600480803560001916906020019091905050610278565b005b60006000151561018e836101cd565b1515141561019c5760006000fd5b60006000836000191660001916815260200190815260200160002060009054906101000a900460ff1690505b919050565b60006000600090505b6001805490508110156102285782600019166001828154811015156101f757fe5b906000526020600020900160005b505460001916141561021a576001915061022d565b5b80806001019150506101d6565b600091505b50919050565b60006020528060005260406000206000915054906101000a900460ff1681565b60018181548110151561026257fe5b906000526020600020900160005b915090505481565b60001515610285826101cd565b151514156102935760006000fd5b600160006000836000191660001916815260200190815260200160002060008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055505b505600a165627a7a7230582078a9c7e748d33d47841c31e12c9ced86eeee8b27eb8f3797df881b1055e806e000290000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000453616e6174000000000000000000000000000000000000000000000000000000416e696b657400000000000000000000000000000000000000000000000000004d616e6461720000000000000000000000000000000000000000000000000000416b736861790000000000000000000000000000000000000000000000000000" into type Data; strings must be hex-encoded and prefixed with "0x".
at Object.InvalidResponse (C:\Users\manis\Desktop\Blockchain1\node_modules\web3\lib\web3\errors.js:38:16)
at RequestManager.send (C:\Users\manis\Desktop\Blockchain1\node_modules\web3\lib\web3\requestmanager.js:61:22)
at Eth.send [as sendTransaction] (C:\Users\manis\Desktop\Blockchain1\node_modules\web3\lib\web3\method.js:145:58)
at ContractFactory.new (C:\Users\manis\Desktop\Blockchain1\node_modules\web3\lib\web3\contract.js:228:33)
at C:\Users\manis\Desktop\Blockchain1\index.js:96:41
at Layer.handle [as handle_request] (C:\Users\manis\Desktop\Blockchain1\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\manis\Desktop\Blockchain1\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Users\manis\Desktop\Blockchain1\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\Users\manis\Desktop\Blockchain1\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\manis\Desktop\Blockchain1\node_modules\express\lib\router\index.js:281:22

Screenshot (51)_LI

this is error

Cannot wrap string value

deployedContract = VotingContract.new(['Sanat','Aniket','Mandar','Akshay'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
Uncaught:
Error: Cannot wrap string value "608060405234801561001057600080fd5b5060405161041d38038061041d833981018060405281019080805182019291905050508060019080519060200190610049929190610050565b50506100c8565b828054828255906000526020600020908101928215610092579160200282015b82811115610091578251829060001916905591602001919060010190610070565b5b50905061009f91906100a3565b5090565b6100c591905b808211156100c15760008160009055506001016100a9565b5090565b90565b610346806100d76000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f265cf714610072578063392e6678146100bd5780637021939f14610106578063b13c744b14610151578063cc9ab2671461019a575b600080fd5b34801561007e57600080fd5b506100a160048036038101908080356000191690602001909291905050506101cb565b604051808260ff1660ff16815260200191505060405180910390f35b3480156100c957600080fd5b506100ec6004803603810190808035600019169060200190929190505050610215565b604051808215151515815260200191505060405180910390f35b34801561011257600080fd5b506101356004803603810190808035600019169060200190929190505050610274565b604051808260ff1660ff16815260200191505060405180910390f35b34801561015d57600080fd5b5061017c60048036038101908080359060200190929190505050610294565b60405180826000191660001916815260200191505060405180910390f35b3480156101a657600080fd5b506101c960048036038101908080356000191690602001909291905050506102b7565b005b60008015156101d983610215565b151514156101e657600080fd5b600080836000191660001916815260200190815260200160002060009054906101000a900460ff169050919050565b600080600090505b60018054905081101561026957826000191660018281548110151561023e57fe5b906000526020600020015460001916141561025c576001915061026e565b808060010191505061021d565b600091505b50919050565b60006020528060005260406000206000915054906101000a900460ff1681565b6001818154811015156102a357fe5b906000526020600020016000915090505481565b600015156102c482610215565b151514156102d157600080fd5b6001600080836000191660001916815260200190815260200160002060008282829054906101000a900460ff160192506101000a81548160ff021916908360ff160217905550505600a165627a7a723058201df63b8ba65c70005c6a094b8409d12dc58001b824c1ec852cf1ae38b9c59dc600290000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000453616e6174000000000000000000000000000000000000000000000000000000416e696b657400000000000000000000000000000000000000000000000000004d616e6461720000000000000000000000000000000000000000000000000000416b736861790000000000000000000000000000000000000000000000000000" as a json-rpc type; strings must be prefixed with "0x".
at Object.InvalidResponse (/home/shamsul/Videos/techdot-patch-1/node_modules/web3/lib/web3/errors.js:38:16)
at RequestManager.send (/home/shamsul/Videos/techdot-patch-1/node_modules/web3/lib/web3/requestmanager.js:61:22)
at Eth.send [as sendTransaction] (/home/shamsul/Videos/techdot-patch-1/node_modules/web3/lib/web3/method.js:145:58)
at ContractFactory.new (/home/shamsul/Videos/techdot-patch-1/node_modules/web3/lib/web3/contract.js:228:33)
Screenshot from 2022-12-16 21-51-30-1

Can not to anyone

i cannot vote for anyone and the database you use "firebase" is not accessible right now. Would you pleasse guide to run and understand the project.

how can we vote and get result ?

after login and click on vote on any of the candidate there is no popup show and how can we show the result of number of votes goes to which party/candidate and who is winning the election?

after running successfully all the steps that you have given and after last step that is:
contractInstance.totalVotesFor.call('Sanat').toLocaleString()
its shows '0' not 2 that is given on your step 4
WhatsApp Image 2022-04-20 at 11 11 58 PM

Vote button not working

Please help the vote is not working,how to link abi file.There is no function happening in the ganache-cli.

Hostname match not found

After doing the required changes and clicking on "Get OTP" button it pops up the message "Hostname match not found". Please help.

Vote is not confirmed

I don't get the pop up message received after the vote is casted. Even the button is not working. I hope the version of outdated. Could you help me

Unable To Vote After OTP Verification

Even After editing aadhaar city, It is shown NEWS : You have done 5 actions. and city is not shown.
Also, Voting is not possible.
Please guide and suggest the changes.

About the project

Sir, can you explain where to execute the project because it is confused

Iam getting this error after entering otp http://localhost:8080/info

TypeError: Cannot read property ':Voting' of undefined
at C:\Users\vikram\Downloads\techdot-master\index.js:93:53
at Layer.handle [as handle_request] (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\index.js:335:12)
at next (C:\Users\vikram\Downloads\techdot-master\node_modules\express\lib\router\index.js:275:10)
at SendStream.error (C:\Users\vikram\Downloads\techdot-master\node_modules\serve-static\index.js:121:7)
at SendStream.emit (events.js:311:20)
at SendStream.error (C:\Users\vikram\Downloads\techdot-master\node_modules\send\index.js:270:17)
at SendStream.onStatError (C:\Users\vikram\Downloads\techdot-master\node_modules\send\index.js:421:12)
at next (C:\Users\vikram\Downloads\techdot-master\node_modules\send\index.js:736:16)
at onstat (C:\Users\vikram\Downloads\techdot-master\node_modules\send\index.js:725:14)
at FSReqCallback.oncomplete (fs.js:166:21)

Invalid JSON RPC response

When I try to depoly the contract invalid jason rpc response error shows up.Please help me resolve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.