A Blockchain is a chain of blocks which contain information. Blockchain is a decentralized, distributed ledger (public or private) of different kinds of transactions arranged into a P2P ( Peer to Peer ) network.
The “peers” are computer systems which are connected to each other via the Internet.
The structure of blockchain technology is represented by a list of blocks with transactions in a particular order. These lists can be stored as a flat file (txt. format) or in the form of a simple database. The data which is stored inside a block depends on the type of blockchain. For Example, A Bitcoin Block contains information about the Sender, Receiver, number of bitcoins to be transferred.
Each Block has
- Hash of the previous block
Let us consider a chain of 3 blocks. The 1st block has no predecessor. Hence, it does not contain has the previous block. The first block in the chain is called the Genesis block. Each new block in the chain is linked to the previous block. Block 2 contains a hash of block 1. While block 3 contains Hash of block 2.
A hash can be understood as a fingerprint which is unique to each block. It identifies a block and all of its contents. Once a block is created, any change inside the block will cause the hash to change.
If someone is able to change the data present in Block 2. Then the Hash of the Block 2 also changes. But, Block 3 still contains the old Hash of the Block 2. So this makes Block 3, and all succeeding blocks invalid as they do not have correct hash the previous block. Therefore, changing a single block can quickly make all following blocks invalid.
Blockchains also use the concept of Proof-of-Work. It is a mechanism which slows down the creation of the new blocks. It takes around 10 minutes to determine the necessary proof-of-work and add a new block to the chain. This work is done by miners – special nodes within the Bitcoin blockchain structure.
Two vital data structures used in blockchain include:
- Pointers – variables that keep information about the location of another variable. Specifically, this is pointing to the position of another variable.
- Linked lists – a sequence of blocks where each block has specific data and links to the following block with the help of a pointer.
The first block does not contain the pointer since this one is the first in a chain. At the same time, there is potentially going to be a final block within the blockchain database that has a pointer with no value.