Skip to content

Implemention of proof of work consensus based Blockchain in Python and DistAlgo. This is project was implemented as a part of course for Distributed Systems (Fall 2018) at Stony Brook University, under the guidance of Professor Annie Liu.

Notifications You must be signed in to change notification settings

sjindal94/Proof-of-Work-Blockchain

Repository files navigation

Implemention of proof of work consensus based Blockchain in Python and DistAlgo

This is project was implemented as a part of course for Distributed Systems (Fall 2018) at Stony Brook University, under the guidance of Professor Annie Liu.

Language and Framework

How to Run Project

  • constants.py

This contains few of the adjustable parameters such as DIFFICULTY, BLOCKCHAIN_LENGTH etc. which can be adjusted to get different results when running the blockchain

  • Execute run.sh to start the blockchain.

By default 5 miners are run which mine the transactions produced by 2 nodes. Each transaction produced by the nodes have a sleep time of 1s. This is because when the difficulty is increased to a larger number, too many tranasactions are pending while the proof of work is being done, which causes buffer overflow. To avoid this, we need to increase the sleep time in node.da when we are increasing the difficulty substantially.

  • Open visualize.html in your web-browser to analyze the blockchain.

Use Zoom-out functionality in the browser to see all 5 blockchains together. You can also hower over each node to see its transactions and previous hash. The red color node is the genesis/starting block.

Visualization

A blockchain with 5 miners, 10 difficulty, and 25 block length

As we can see there are many forks which are occurring due to low difficulty.

A blockchain with 5 miners, 15 difficulty, and 25 block length

The number of forks were reduced to 1 on increasing difficulty to 15.

References

Authors

  • Shubham Jindal
  • Arun Swaminathan

About

Implemention of proof of work consensus based Blockchain in Python and DistAlgo. This is project was implemented as a part of course for Distributed Systems (Fall 2018) at Stony Brook University, under the guidance of Professor Annie Liu.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published