top of page

Bitcoin Block Header

  • Writer: r rar
    r rar
  • 5 hours ago
  • 4 min read

Block Header:

Each block has two fundamentally different parts.

1.       Transactions that occurred after sealing the last block.  A block is created every 10 minutes.  So it's fair to say any given block would contain all transactions that occurred ten minutes prior to the

creation of that particular block.

 

2.       Block Header

 

Block header is the subject of this chapter.

Block header has following fields.

1.       Version number

2.       Hash of the header of the previous block

3.       Merkel root   (Transactions hashed)

4.       Time stamp

5.       Difficulty level of the block mining

6.       Nonce  (Used to generate the target hash)

Now let us look at these items in detail.

Version Number:

Version number can be changed by someone indicating that he/she would like to introduce a new version.  This is known as soft fork or hard fork proposals.  If large majority of bitcoin miners agree, then the new version would come into existence.  New version will not accept the old version in the future.  Some hard forks are bitcoin gold and bitcoin cash.  Also version field can be used to minimize the hash of the header when nonce numbers have run out.  Nonce field is only four bytes.  (or 232 bits).  232 is in decimals 4294967296. 

For an instance Avalon miner 741 can mine 8 Tera hash/second.  Tera is 1012.

This machine can go from start to end in the nonce field in 4294967296/(8 x 1012) seconds.

In other words this machine would complete the nonce field in 0.000537 seconds.  Hence more changes are needed to achieve the minimum target.  For that version field is mostly used.

Hash of the header of the previous block:

This connects the new block to the previous block.  If anyone to change the hash of the new block he/she may have to make changes to the hash of the previous block.  Then change the one before that etc.  This is considered to be impossible even for large entities.

 

 

 

Merkel root   (Transactions Hashed):

Merkel root is the hash of all transactions.

Merkle tree is used to store transactions in bitcoin blocks.

So let us look at what the Merkle chain is.

Let us say we need to send four files to a friend.

 

File 1  -

File 2

File 3

File 4

 

Now we need to be sure that our friend received the files without any change during transmission.  Also, it is possible someone else captured the files and made changes to them.

We can solve this problem by sending the files with their hash.

 

File 1  - Hash 1

File 2  - Hash 2

File 3  - Hash 3

File 4 – Hash 4

 

Now you can send the four files with their hashes to your friend.  Your friend in the other end can take the file and hash it and see whether the hash has changed.  If the hash has changed that means the file has changed.  Now when you are sending 100s of files, it is extremely computational to check the hash function for each and every file. 

Hence Merkel tree can be used.

 

 

 

 

 

Merkel Tree:

 

 





 

 

Now we would send four files and hash 1 thru 7.

What do we send?

File 1, file 2, file 3, file 4 and

hash 1, hash 2, hash 3, hash 4, hash 5, hash 6 and hash 7.

 

Then he would obtain the four files and compute hash 1, 2, 3 and 4.

With those hashes, he can compute hash 5 and 6.

Then he can compute hash 7.

If there is no change to files, there is no reason for hashes to change.

Now let us say the receiver obtained the files and ran the hashes, and found out hash 7.  Let us say hash 7 that he computed is different from the hash 7 we sent him.

Now he knows something is wrong.  Then he would compare his computed hash 5 and hash 6 with the hash 5 and 6 that we sent him.  Let us say he finds the change is in hash 5.  Then he would check computed hash 1 and hash 2 with the hashes that we sent him.

Let us say there is discrepancy hash 2.  His computed hash 2 is different than the hash 2 that we sent him.  Then he can see that the change has happened to file 2.

 

This is much more computationally efficient than obtaining hash functions of 100s of large files.

Time stamp:

Time stamp shows the time the block was created.  This comes from the network.

Difficulty level of the mining of a block:

Presently hash of the header should have 17 zeros prior to any other number.  This difficulty level is encoded and the hash have to be lower than this difficulty level.

Nonce  (Used to generate the target hash):

Nonce field is used to generate the hash function of the block header.  Function of the nonce was explained under the hash function.

 

 

 
 
 

Comments


bottom of page