diff --git a/.idea/dapp-elections.iml b/.idea/dapp-elections.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/dapp-elections.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ae8627a
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..8423510
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,241 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1513691979526
+
+
+ 1513691979526
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.ME b/README.ME
new file mode 100644
index 0000000..30340eb
--- /dev/null
+++ b/README.ME
@@ -0,0 +1,29 @@
+## Decentralized elections app
+
+using the etherum block chain, smart contract , solidity , web3 a simple decentralized voting app
+
+## Dependencies
+
+* ethereumjs-testrpc
+* web3
+* solc
+
+Install missing dependencies with [npm](https://www.npmjs.com/).
+
+## Usage
+
+Run the following commands to open the node console then deploy your contract to the test chain
+
+```
+siraj:~/hello_world_voting$ node
+> Web3 = require('web3')
+> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:3000"));
+> code = fs.readFileSync('voting.sol').toString()
+> solc = require('solc')
+> compiled = solc.compile(code)
+> abiDefinition = JSON.parse(compiled.contracts[':Voting'].interface)
+> VotingContract = web3.eth.contract(abiDefinition)
+> byteCode = compiledCode.contracts[':Voting'].bytecode
+> deployedContract = VotingContract.new(['Trump','Hilary'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
+> deployedContract.address
+> contractInstance = VotingContract.at(deployedContract.address)
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..93e9cbe
--- /dev/null
+++ b/index.html
@@ -0,0 +1,36 @@
+
+
+
+ Hello World DApp
+
+
+
+
+Elections Application
+
+
+
+
+ Candidate |
+ Votes |
+
+
+
+
+ Trump |
+ |
+
+
+ Hilary |
+ |
+
+
+
+
+
+Vote
+
+
+
+
+
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..2dcde2a
--- /dev/null
+++ b/index.js
@@ -0,0 +1,24 @@
+web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:3000"));
+abi = JSON.parse('[{"constant":false,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"totalVotesFor","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"validCandidate","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"votesReceived","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x","type":"bytes32"}],"name":"bytes32ToString","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"candidateList","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"voteForCandidate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"contractOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"candidateNames","type":"bytes32[]"}],"payable":false,"type":"constructor"}]')
+VotingContract = web3.eth.contract(abi);
+// In your nodejs console, execute contractInstance.address to get the address at which the contract is deployed and change the line below to use your deployed address
+
+contractInstance = VotingContract.at('0x4a9c1d265d06d47e8f7b03ffa234a918ccf622');
+candidates = {"Trump": "candidate-1", "Hilary": "candidate-2"};
+
+function voteForCandidate() {
+ candidateName = $("#candidate").val();
+ contractInstance.voteForCandidate(candidateName, {from: web3.eth.accounts[0]}, function() {
+ let div_id = candidates[candidateName];
+ $("#" + div_id).html(contractInstance.totalVotesForCandidate.call(candidateName).toString());
+ });
+}
+
+$(document).ready(function() {
+ candidateNames = Object.keys(candidates);
+ for (var i = 0; i < candidateNames.length; i++) {
+ let name = candidateNames[i];
+ let val = contractInstance.totalVotesFor.call(name).toString();
+ $("#" + candidates[name]).html(val);
+ }
+});
diff --git a/voting.sol b/voting.sol
new file mode 100644
index 0000000..edc479b
--- /dev/null
+++ b/voting.sol
@@ -0,0 +1,25 @@
+pragma solidity ^0.4.11;
+
+contract Voting{
+ mapping (bytes32 => uint8) public totalVotes;
+ bytes32[] public candidatesList;
+
+ function votingList(bytes32[] candidatesNames){
+ candidatesList=candidatesNames;
+ }
+ function totalVotesForCandidate(bytes32 candidate) returns (uint8){
+ return totalVotes[candidate];
+ }
+ function hilary(bytes32 candidate){
+ if(validCandidate(candidate)==false) throw;
+ totalVotes[candidate]+=1;
+ }
+ function validCandidate(bytes32 candidate) returns (boolen){
+ for(uint i =0;i