- I have used the Ballot contract that comes with Browser Solidity
- Modified the Ballot contract to make it more user friendly. The Ballot Proposals are now Strings
- This repo is loosely based on Mahesh Murty tutorial on Medium. Link - https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f
- I have used a private Blockchain and my code takes care of fund transfer, unlocking the accounts etc.
Steps:-
- Before truffle migrate unlock your coinbase
truffle console web.personal.unlockAccount(web3.eth.coinbase,'password',15000);
Deploy the app using- truffle migrate
- Once the Ballot.json is generated. You can use npm run dev
to start the App
-
Hit the App with http://localhost:8080
-
Initially the vote count is zero
-
Generate some accounts in geth/truffle console personal.newAccount(); password : test
-
Use your coinbase address as your Ballot Chairman Address, Coinbase Pwd as chairman password and address generated in Step 5 as Voter address.Give Address the right to Voter
-
Once the address has right to Vote in Blockchain, they can vote for one of the three proposals. Once they Vote and it becomes part of blockchain, Vote count is updated.