Clone the project,
git clone https://github.com/pat0nn/b-vote.gitInstall the dependencies,
cd b-vote
pip install -r requirements.txtStart blockchain server,
python app.pyor
python3 app.pyOne 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 8001Here are a few screenshots
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
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 8001Then 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/chainUse JSON Viewer extension to display the chain visually





