Create your own blockchain using Python by Mukesh Mishra
A blockchain is a digital ledger in which transactions chained together in a chronological order i.e. it’s a continuously growing list of records (blocks the most recent transaction) are recorded and added in chronological order where all stake holders can keep track of digital currency transactions without central record keeping. It was introduced by Satoshi Nakamoto in 2008.
Blockchain is tightly coupled to concepts like decentralized system, smart contracts, cryptocurrencies and chained transactions.
Python is most preferable due to simplicity and easy to learn.
Before going to start making our own blocks, let first understand what is blocks. A block contains transaction data, a time stamp, and a link to a previous block.
Creating the blocks
First import hashlib package to use secure hashes and message digests algorithms and date time package
Create a class and define a function to make a block using sha256 algorithm
Then create a first block which is called a genesis block
Now define a function to create a next block using details of previous block
Now define number of blocks want to add in your chain (blockchain)
Now blocks are created, have fun and play with code to get details of each blocks like time stamp / hash etc.
If you like this post then don’t forget to clap!