Block Structure in Bitcoin Blockchain

Block Structure in Bitcoin Blockchain

In previous post, we explained about basic structure of block in Blockchain so we recommend to read that post before you start with this post.

 

How block in bitcoin differ from standard block ?

Block in Blockchain consist of main two things, one is block header and other transactions that get stored in that block. Same structure apply to bitcoin as well but with few more additional items and that we will discuss in this blog post.

 

Pre-Requisites

Become your self familiarize with Merkle tree using this post  where the basics of Merkle tree is discussed and highlighted the features.

 

Some Facts for Bitcoin Block

Block Size: On average, Bitcoin block has 1 MB size.

Transactions Count in Block: On average, Bitcoin block has 500 transactions in each block.

 

 

High Level Overview of Block Structure

Below diagram show the high level overview of Block structure in Bitcoin. Block has

  • 5 Items in total
  • 6 items in Block Header
Block in Bitcoin Blockchain

Block in Bitcoin Blockchain

Block Items

  • Magic No
  • Block Size
  • Block Header
  • Transaction Counter
  • Transactions

Now let's under these one by one.

 

Magic Number

This is 4 byte value and value is always 0xD9B4BEF9. Now the question comes what is magic number.

 

What is Magic Number?

Magic number is not confined to bitcoin, this is used in computer science mainly for files. Let's take one example to understand it.

There are 3 types of files ( F1 , F2, F3) and Person 1 is sending these files to Person 2. When Person 2 receive these files, he need to place F1 type of files to Folder 1, F2 type of files to Folder 2 and F3 type of files to Folder 3.

Now question comes how this can be achieved. This can be achieved with the help of Magic number. Now question comes how it is done ? so let's understand.

What we do , we assign magic number to each type of file like number 123 for F1 types of file, 456 for F2 types of file, 789 for F3 types of files, now when Person 1 send the F1 types of file, he add magic number to that files so that Person 2 can identify that this file is F1 type and move to Folder 1.

Block Size

This is size of the block in bitcoin, as mentioned before average size is 1 MB.

Block Header

This is very important part in Block structure and this has further 6 items. We will explain this later in this post.

 

Transaction Counter

This depicts the number of transactions stored in that block.

 

Transactions

This is all the transactions stored in that block.

 

Block Header

Block header in Bitcoin has

  • version
  • previous block hash
  • merkle root hash
  • timestamp
  • difficulty
  • nonce

Now let's try to understand it in detail.

 

previous block hash

Immutable is one of the main feature of Blockchain, that means once information added to Blockchain, it is impossible to change the information. Blockchain achieve this with "pointer to previous block hash" section in the block. Here reference to previous block is there in current block and that is similar to link list concept.

Timestamp

Timestamp is the epoch Unix time of the time of block initialization.

 

Nonce

Below is the definition from Wikipedia.

"In cryptography, a nonce is an arbitrary number that can be used just once. It is similar in spirit to a nonce word, hence the name. It is often a random or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks. They can also be useful as initialization vectors and in cryptographic hash functions. Also known as a 'Crypto Nonce' ".

In short, it is integer value that miner use when they perform mining to generate required hash.

 

Merkle root hash

Merkle root hash is hash of top node of Merkle tree. To read more about it refer this article.

 

Difficulty

This is difficulty level set in the block to mine it. This gets adjusted during mining if block mining taking time.

No Comments

Post a Reply

Inquire Now
close slider