Implementation of Delegated Proof of Stake(DPoS) consensus algorithm
- Deep Chordia (2020A7PS2073H)
- Neeraj Gunda (2020A7PS0169H)
- Sravika Linga (2020A7PS1310H)
This assignment focuses on implementing blockchain for maintaining land records. The consensus algorithm used is Delegated Proof of Stake(DPoS).
- All the methods are defined in blockchain.py and the API routes in app.py
- The DPoS consensus algorithm is defined in blockchain.py file.
- The merkle.py consists all the functions required to produce merkle root (https://github.com/Tierion/pymerkletools)
- We can add nodes to the network using the /add/user API endpoint, while adding user it is required to specify the unique property's name
- For the voting mechanism, we are using randint function for each node and the vote(their stake) is assigned to the index generated
- The result function sorts and gives us the 3 eligible miners
/add/users/
This POST route allows us to add new users(nodes) to our blockchain network
/add/transaction/
This POST route allows us to add new transactions(smallest element of a block) to our blockchain network
/history/
This POST route shows us the entire transaction history related to a specific property
/chain/
This GET route allows us to view the blockchain(all the blocks added to blockchain)
/voting/
This GET route initiates the voting process, it sorts the users accoring to the votes they received(stake included) and displays the votes received. Only primary node is eligible to host election
/witnesses/
This GET route displays the the top 3 nodes who received the maximum amount of votes, only these nodes are allowed to mine the block
/mine/
This GET route used for mining the block, a minimum of 2 transactions are required for witnesses(delegates) to mine a block.
- This project was built using Python-Flask framework
- Postman was used to test and interact with the endpoint