Structure of blockchain

In this section, we will learn about the following aspects of blockchain: its structure; its building blocks; and its core parts that make it disruptive, robust, strong, and tamperproof.

Let's have a look at the structure of the blockchain. The blockchain structure is very similar to that of linked lists or binary trees. Linked lists or binary trees are linked to each other using pointers, which point to the previous or next list elements on the nodes in the linked list. The structure of blockchain is not really different from that of binary trees, but the major difference is that blockchain is tamperproof and it is also very easy to find out if any tampering has taken place.

In the following diagram, we will look at a representation of how blockchain is constructed and how it is a linked list:

Let's now discuss the structure and elements of the blockchain.

The blockchain is a linked list that is built with hash pointers instead of pointers. This is the exact reason why blockchain, though it resembles a linked list, is different because, in the linked list we have been using the pointers to point to previous nodes for the elements in the lists, but in the case of the blockchain, the pointers are hash pointers and not just simple pointers.

So, typically, any block in the blockchain consists of three parts, or feet such as a Header, Merkle, and Transaction's Id list. This is a newly created block.

We can see the structure of blockchain in the following diagram:

We will now look into the following blocks and their elements:

The block is then created with all of the preceding details. This newly created block gets added to the blockchain.

Now, let's look at what the Merkle tree is, as follows:

Now, let's look at a representation of the Merkle tree in the following diagram:

Here is a brief overview of what the top hash, data blocks, and Merkle root stand for, as follows:

If any change or tampering occurs in any part of the transaction data, we can see this compromise in a bold and clear manner. Hence, the Merkle tree is important in the implementation of blockchain and is a major contributor to making sure that blockchain data has not been tampered with.