Blockchain Data Structure
In this lesson, we well discuss the data structure of blockchain
We'll cover the following
What is blockchain? #
In a blockchain system, data is stored in blocks of transactions. The most common definition is as follows:
A timestamped log of transactions that is replicated on multiple peers.
Distributed Consensus #
Now, some of these peers might be evil and intentionally report a tampered version of blockchain data. The entire network uses democracy to come to a consensus on the current state of data and any non-conformant or outlier peers are ignored/blocked.
This means that in order for a blockchain network to be fair and valid, most of the nodes have to be fair. If 51% of the nodes are compromised the network is hacked. Since the networks are globally distributed, this is not a possibility.
Data Storage in Blocks #
Let’s see how blockchain stores data in blocks. Each block stores a data blob(which is usually a list of transactions), its block number, and hash of the previous block:
Each block is represented by a json object here for better understanding:
Get hands-on with 1200+ tech skills courses.