You won't believe what I found inside a Block π
Ever wondered what's inside a Block of a Blockchain? Let's figure out....
We met yesterday after several weeks π
She's been immersing herself in the blockchain space lately (Your Man got some influence on her).
Among the numerous questions she asked, I couldnβt explain one of the questions properly, "What exactly is contained within a block?"
You know, as a child, I always aspired to become a doctor, but my passion for technology ultimately overtook that childhood dream. Her inquiry rekindled a spark of childhood curiosity within me. I put that young aspiring doctor to work, dissecting a Block, and here's what I discovered.
A Block can be divided into two main parts:
Data
Block Header
Data
Also referred to as the payload, this part of the block includes transaction details such as:
Sender: The address of the user who initiated the transaction.
Receiver: The address of the recipient of the transaction.
Transaction ID: A unique identification for the transaction generated using Hash Functions.
Amount: The sum entered by the sender before initiating the transaction.
Gas Fees: The fee paid by the sender to initiate the transaction.
The amount of data a block can store depends on the block size. For example, Bitcoin has a block size of 1MB, and the size of each transaction is typically around 300 bytes. So, 1MB divided by 300 bytes equals 3,333, which is the maximum number of transactions that can fit in a Bitcoin Block.
Block Header
The Block Header is a crucial component of each block. It contains metadata that helps secure and validate a block's content (Data). The Block Header consists of several elements:
Block Number: This is the identification number of each block, assigned when a block is added to the chain. The first block of any blockchain is called the Genesis Block, starting with number 0 (e.g., the Bitcoin Genesis Block).
Block Version: It's the version number of the blockchain at the time the block was mined. New versions may have different content and sizes, so tracking the block version is important.
Timestamp: This field records the time when the block was created or mined. Timestamps ensure that blocks are added to the blockchain in a consistent and chronological order.
Previous Hash: Just like in linked lists, a block is connected to the chain with the previous block's hash as one of its fields in the new block.
Merkle Root: This is a cryptographic hash of all the transactions included in the block. The Merkle root is generated by hashing pairs of transaction hashes repeatedly until a single hash value, known as the Merkle root, is achieved. It's used to efficiently verify the presence of a transaction within a block and maintain data consistency.
Nonce: The "number used only once" is a variable number that miners use to solve a mathematical problem to generate a valid hash. Because data cannot be changed, miners choose a nonce that will produce a valid hash value. This is often referred as βSolving a Mathematical Problemβ.
Difficulty Target: This value determines the mining difficulty for the block. Miners must find a nonce that, when hashed with the block header, produces a hash value lower than the current difficulty target. This mechanism controls the rate at which new blocks are added to the blockchain and ensures competitive mining.
Block Hash: The block hash is the outcome of hashing the entire block header. To be considered valid, this hash must meet the current difficulty target, demonstrating that miners have performed significant computational work to create the block.
Hope our Blockchain 101 Series is giving you some insights into the technical jargon of this amazing technology :)
Read Previous Letter in the Series π
See ya! Happy Learning π