Skip to content

pat0nn/b-vote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VOTING SYSTEM USING BLOCKCHAIN


Instructions to run the application

Clone the project,

git clone https://github.com/pat0nn/b-vote.git

Install the dependencies,

cd b-vote
pip install -r requirements.txt

Start blockchain server,

python app.py

or

python3 app.py

One instance of our blockchain node is now up and running at port 8000.

You can change the port by adding the "port "variable (such as 8001)

python3 app.py 8001

Here are a few screenshots

1. Login

image.png

2. Register

image.png

3. Homepage

image.png

4. Votepage

image.png

5. Result (Admin only)

image.png

Note: You can change admin in credentials.py file. Login with the admin account and go to the result page by adding the /adminPortal endpoint

6. Chain

image.png


To play around by spinning off multiple custom nodes, use the register_with/ endpoint to register a new node. You can do this by run a new port in another terminal. Example:

python3 app.py 8001

Then you can use the following cURL requests to register the nodes at port 8001 with the already running 8000.

curl -X POST \
  http://127.0.0.1:8001/register_with \
  -H 'Content-Type: application/json' \
  -d '{"node_address": "http://127.0.0.1:8000"}'

Or using Powershell :

Invoke-RestMethod -Uri 'http://127.0.0.1:8001/register_with' -Method Post -Headers @{'Content-Type'='application/json'} -Body '{"node_address": "http://127.0.0.1:8000"}'

This will make the node at port 8000 aware of the nodes at port 8001 and make the newer nodes sync the chain with the node 8000, so that they are able to actively participate in the mining process post registration.

Once you do all this, you can run the application, create transactions (post vote via the web inteface), and once you mine the transactions, all the nodes in the network will update the chain. The chain of the nodes can also be inspected by inovking /chain endpoint using cURL.

http://localhost:8001/chain

Use JSON Viewer extension to display the chain visually

References

BLOCKCHAIN-VOTING-SYSTEM

E-voting-system-using-blockchain-and-python

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors