This repo is a fork of the excellent blockchain tutorial by @adilmoujahid. The code is modified a bit to implement a crude blockchain based voting system. All "votes" are simply transactions of value 1 from the sender to one of two options. The changes from @adilmoujahid's version are:
- Combine the wallet generation and transaction page into one
- Voter shouldn't be able to see other votes. Hence the "View transactions" route and the main nav are removed.
- Replace "value" option in the transaction form with a hidden field with
value="1" - Remove value column from blockchain frontend. Add voting tally
For an alternate explanation of blockhains, see 3blue1brown's video https://www.youtube.com/watch?v=bBC-nXj3Ng4&frags=pl%2Cwn
- Source Code for my blog post: A Practical Introduction to Blockchain with Python
Important: This project is for educational purposes only and the source code shouldn't be use in production as it doesn't have good security, doesn't scale well and lacks many important features.
The github repository contains a basic implementation of a blockchain and its client using Python. This blockchain has the following features:
- Possibility of adding multiple nodes to the blockchain
- Proof of Work (PoW)
- Simple conflict resolution between nodes
- Transactions with RSA encryption
The blockchain client has the following features:
- Wallets generation using Public/Private key encryption (based on RSA algorithm)
- Generation of transactions with RSA encryption
This github repository also contains 2 dashboards:
- "Blockchain Frontend" for miners
- "Blockchain Client" for users to generate wallets and send coins
- Works with
Python 3.6 - Anaconda's Python distribution contains all the dependencies for the code to run.
- To start a blockchain node, go to
blockchainfolder and execute the command below:python blockchain.py -p 5000 - You can add a new node to blockchain by executing the same command and specifying a port that is not already used. For example,
python blockchain.py -p 5001 - TO start the blockchain client, go to
blockchain_clientfolder and execute the command below:python blockchain_client.py -p 8080 - You can access the blockchain frontend and blockchain client dashboards from your browser by going to localhost:5000 and localhost:8080
