Structure of the Block inside a Blockchain Network
Tags: blockchain, web3, crypto, bitcoin
Published: 2022-03-22 04:02:50

**Hey Guys,**

What's up?

**So**, today we will see, the _structure of the block_ inside a _blockchain_ network.

Let's start!

wait, wait...

Before starting, I guess you are familiar with _Blockchain_, if not, then please read my previous article [here](https://saroj.hashnode.dev/how-does-the-blockchain-work).

Will it work for you?

**Awesome**!

Then why wait? let's start :)

As you know, _blockchain_ is consists of a chain of blocks, it is must necessary to have some data inside a _block_. Without any data, it is impossible to insert a new _block_. Data are like oxygen for humans; without oxygen, humans can't live. Like this way, without data, _blocks_ inside a _blockchain_ network can't exist(It must have some data).

I can't relate to a better example for this. Just kidding. :)

Cool!

**Now, let's see the structure of a block!**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/anzk5vs304p28fsyj0af.png)

As you can see in the above diagram, a _block_ is differentiated into 2 parts.

1. Block Head
2. Block Body

Let's talk about **Block head** first.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uwdokdjhbkf7dxzcq21.png)

_Block head_ is also divided into six components. Those are

- Version number
- Previous block hash
- Merkle tree root hash
- Nbits
- Nonce
- Timestamp


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnaq8uvwzfcft203xzrc.png)
The _block_ version number indicates which set of _block_ validation rules to follow. This is useful for a miner, who wants to mine(to insert a new block) inside the _blockchain_ network. That means, let's say I want to mine, I need the _block_ version to check the rules and regulations provided by that version. Every _block version_ has some rules to follow, which is provided by the _blockchain_ network.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/firj7bemsm24cgj0bb9z.png)
A _Markle tree_ encodes the _blockchain_ data in an efficient and secure manner. It enables the quick verification of the _blockchain_ data.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eiw6plylg6njq051yicc.png)

The data itself is first hashed. Then the hashes are hashed again and merged. Finally, the Merkle tree merged into a single hash, called _root hash_. It is also called the root of the tree.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fuqi412o3lhr0owtk34p.png)
The hash of the previous _block_ is the chain of _blockchain_. Because the hash of the previous _block_ is contained on a hash of the new _block_. The blocks of the _blockchain_ are all built on each other.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlu5kp5mt2a576hypalv.png)
With the help of _n Bits_, the current difficulty is used to create this _block_. This means it will decide how the _block_ is to be going to create.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gd69lpbr2e3ghgn0qbhn.png)
A _nonce_ is a variable increment by the Proof-of-Work([PoW](https://www.investopedia.com/terms/p/proof-work.asp)). In this way, the miner guesses a valid hash, a hash that is smaller than the target.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lumxviyxc4nm7krpmr61.png)
And _timestamp_ is the _block_ itself. Each _block_ contains a unique _timestamp_. A _timestamp_ is accepted as valid if it is greater than the median of the previous 11 blocks and less than the network adjusted time. Network adjusted time is the median of all blocks present inside the _blockchain_ network.

**Now, let's talk about the Block body.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2awte1w789vc24chcpzz.png)

The _transaction counter_ is the place where all transactions are done. Let's say, there are 10 transactions is done inside a _block_, then transaction counter creates a copy of every single transaction for its future reference. And those transactions are stored separately.

Here, we ended up with the _structure of a block_ inside a _blockchain network_. I know, it's kind of confusing, if you are new to _blockchain_. But I'm pretty sure, you must have got some idea about the _block_.

Right?

**Awesome!**

If you further need any help, try to connect with me. I'll be happy to solve your doubts.

Till then, keep learning and keep smiling :)

Thanks for reading this. See you soon with a new article.

[LinkedIn ](https://www.linkedin.com/in/sarojvrc/) 
[Twitter](https://twitter.com/iamsarojb)