This is the code for this Medium article published by Alberto Cevallos on using Python for mechanism design.
- Part I: Build a Simple Blockchain Using Python
- Part II: Design and Test Mechanism
Take into account that blockchain protocols couple different types of mechanisms for different purposes (using PoW or PoS for sybil control, or PBFT or Tendermint for decision making/consensus). Many combinations are possible but not all make sense.
Much of the design work consists in understanding what are the different attack vectors, governance objectives and desired product requirements (eg. speed, level of security). From that point on, it's reverse engineering the desired outcome using cryptographic protocols and economic games (rewards, penalties, participation thresholds).
- hashlib
- datetime
You can install the dependencies using pip.
You can clone the jupyter notebook version blockchain.ipynb file but I recommend using the Google colab link and run the code from there.
Thanks to howcodeORG for the base blockchain simulation code.