Structure of a Block in Blockchain

Structure of a Block in Blockchain

4 mins read19.8K Views Comment
clickHere
Updated on Aug 9, 2023 15:31 IST

Blocks are the basic constructs of blockchain. Each block contains a set of transactions, metadata, and mining information.

2022_04_Structure-of-a-Block-in-Blockchain.jpg

In this article, we’ll go through the components and structure of Blockchain’s block. We’re going to take the Bitcoin block as an instance. Bitcoin is a popular permissionless public blockchain network. Before getting into block anatomy, let’s begin with understanding blockchain briefly.

Contents

What is Blockchain?

Blockchain comes under Distributed Ledger Technology (DLT). It’s a distributed database that records– who transacts what to whom and who owns what? Hence, a blockchain is a decentralized database containing imprints of assets and transactions across a whole network. Each node/system in the network shares the exact same copy of records, making it nearly impossible to disrupt or alter.

All nodes or systems are connected peer to peer (P2P) in a network. This distribution is on a conceptual network level. 

blockchain

However, when it comes to storing the ledger of the transactions in a blockchain network, it’s different. Let’s understand it clearly.

What is Block in Blockchain?

Block in a Blockchain–

  • Blockchain is a linear chain of blocks.
  • Each block contains a set of transactions and other essential details.
  • Blocks are linearly connected and cryptographically secured.
blocks
  • Each block header contains the previous block hash, current block hash, nonce, Merkle root, and other details.
blocks image
  • All blocks are connected linearly by carrying the hash of the previous block.
  • The previous block hash is used to compute the current block hash.
  • The first block with no previous block hash is called “Genesis Block.”
  • For adding a new block to the network, the blockchain follows consensus mechanisms like proof of work (PoW), proof of stake (PoS), etc.

Structure of a Block

Let’s just draw a conceptual image of a block with reference to a ledger of transactions.

Block conceptually

The above image will create a simpler conceptual block visualization in your head. However, the actual block contains a lot more information than the ledger image above.

Following are the significant elements of a block – 

Block Height – 

It’s the sequence number of the block in the chain of blocks. Block Height: 1 is the genesis block (first block in the network).

Block Size –

It’s a 4-bytes or 32-bit field that contains the size of the block. It adds size in Bytes. Ex – Block Size: 216 Bytes.

Block Reward –

This field contains the amount rewarded to the miner for adding a block of transactions.

Tx Count – 

The transaction counter shows the number of transactions contained by the block. The field has a maximum size of 9 bytes.

Block Header –

The Block header is an 80-Byte field that contains the metadata – the data about the block. 

Let’s briefly discuss the 6 components of the Block Header.

  1. Time –  It’s the digitally recorded moment of time when the block has been mined. It is used to validate the transactions.
  1. Version – It’s a 4-bytes field representing the version number of the protocol used. Usually, for bitcoin, it’s ‘0x1’.
  1. Previous Block Hash – It’s a 32-bytes field that contains a 256-bits hash (created by SHA-256 cryptographic hashing) of the previous block. This helps to create a linear chain of blocks. 
  1. Bits – It’s a 4-bytes field that tells the complexity to add the block. It’s also known as “difficulty bits.” According to PoW, the block hash should be less than the difficulty level.
  1. Nonce – It’s a 4-bytes field that contains a 32-bit number. These are the only changeable element in a block of transactions. In PoW, miners alter nonce until they find the right block hash.
  1. Merkle Root – A 32-bytes field containing a 256-bit root hash. It’s constructed hierarchically combining hashes of the individual transactions in a block. 

Also, Read – Merkle Tree in Blockchain

Transactions

It’s a variable-size field that includes the list of all transactions contained in the block.

FYI, each bitcoin block contains about 2000 transactions. The size of each block is approx 1MB. The size and number of transactions in a block vary in blockchains. It’s decided based on network congestion and communication overhead.

Let’s see what an actual bitcoin block looks like. This image contains a block summary of a transaction.

Why don’t you check it yourself? Visit: https://btc.com/btc/block/1000

In Conclusion

Blocks are the basic constructs of blockchain. Each block contains a set of transactions, metadata, and mining information. The above article covered details of a block in blockchain technology. 

Hope you enjoyed and learned something new reading this article. 

FAQs

What is Merkle Root?

Merkle root is the final node of the Merkle tree structure, which helps verify a block's data integrity. It is made up of hashes of transactions added to a block.

What is Cryptography?

Cryptography is a process to encrypt and decrypt a message. Encryption, message to ciphertext. Decryption is converting the ciphertext to the message. The process intends to secure and compress the original message.

What is a Hash?

Hash is a fixed-length sequence of hexadecimal output of a message or transaction here. Hash functions like SHA-256 use to create hashes.

What is Consensus Mechanism?

A consensus mechanism helps to keep the network synchronized. It's a state of agreement where all the network participants decide together.

About the Author

This is a collection of insightful articles from domain experts in the fields of Cloud Computing, DevOps, AWS, Data Science, Machine Learning, AI, and Natural Language Processing. The range of topics caters to upski... Read Full Bio