Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

ihabbou/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain Voting System

Blockchain project BlockChainReaction.

A voting system that uses blockchain technology.

Overview

Blockchain implementation using the DPoS consensus algorithm.

The miner runs a blockchain server and collects the votes from the web user interface. Those votes are then added to the blocks and mined with the DPoS algorithm.

Every user logs in using his id (private key) to the web interface and chooses one from a set of candidates. Then a 'transaction' is applied with the selected candidate's data in the transaction.

Instructions

All blockchain scripts should be run from the root directory, and the front end scripts should be run from the subdirectory /front-end.

  1. Install all dependencies:

    For the blockchain:

    npm install

    For the front end:

    cd front-end

    npm install

  2. First, Distribute tokens on voters:

    npm run distribute

    It may take a while to obtain enough tokens to distribute and then synchronise the transactions. Make sure to shut it down manually if it does not shut down automatically.

  3. Now to set up the voting machine

    Note: due to a problem in closing and reopening leveldb, voting using a changing node for different voters fails. So, the node 0 is used instead. Check this branch for the non-working version that should be fixed soon.

    Run the transaction creator:

    npm run linker

    Then start the user interface

    cd front-end

    npm start

  4. To vote, get a private key and use it to login

  5. Finally for the election results, make sure to terminate all other blockchain parts (blockchain network + transaction creator) first

    npm run results

    You should wait until all nodes have received the transaction. the networking feature from github.com/yjjnls/awesome-blockchain seems to take a while so make sure to see all the "node # load tx ..." for all nodes.

  • To display the entire blockchain:

    npm run display

Structure

The project uses the port 3000 for the front end and the blockchain uses the ports 7999 to 8020.

Make sure that these ports are unoccupied.

(P.S. Normally, these data are stored on a seperate government database which requires the set up of extra servers and interfaces.)

Releases

No releases published

Packages

No packages published