Create your own Blockchain using Python and Ethereum
Blockchain, as the name suggests, is a collection of blocks or data records chained together in a cryptographic fashion. Each block in the chain contains a hash of the previous block, timestamp, and the transaction data, securing it from intruders/attackers and modifications in the future. This immutability is one of the most interesting features of the Blockchain. Transactions, once written, are very difficult to modify (it is possible to modify the chain from a particular block but that means splitting the chain in two and to do that 51% of the miners have to agree to use the new chain.)
The best thing about Blockchain that makes it secure is the way it is decentralized, meaning you cannot access it from any centralized location or modify certain blocks in a Blockchain to hack the transactions. Any attempt to modify the chain needs consensus from more than 50% of the miners for the chain. Very difficult to achieve.
In this blog, I will be talking about some basic Blockchain concepts and I will try to illustrate them with an example of creating a simple Blockchain using Ethereum and Python on a Linux/Ubuntu box.
- Any Ubuntu VM (desktop/server) with minimum 2 GB RAM and 10 GB disk space
- Python 3.5 or 3.5+
- Ethereum basics
- Basic understanding of Blockchain
So, let’s start with your very own Blockchain:
1. The first step in creating Blockchain is to create an initial block of the chain using the config file. This initial block will basically define the properties of your whole Blockchain.
2. Under your working directory create a JSON file that holds the configuration for the initial block…read more.