What’s inside a Block in Blockchain? — blocktrain.info
The Blockchain Anatomy
When I was a kid, it was one of my dream to become a doctor but computer science persuaded me more than anything. So, for a moment I thought of living the childhood dream along with my passion. I dissected a blockchain to look into it and here’s what I found.
Partitioned into two components
- Data
- Block header
Data
The Data part of the block consists information regarding the transaction like From, To and money. These are the same transaction details we see on a blockchain explorer like etherscan or bscscan
Block Header
A Block Header contain
- Block Number
- Version
- Timestamp
- Previous Hash
- Merkle Root
- Nonce
Block Number
It’s the identification number of the block, given to it when it’s added to the blockchain. You can look in a block if you know it’s block number just like your friend reaches your home when he knows your address.
Version
It registers the version of the chain when the block was created. A different version might have more elements in the block, so it’s important to keep track of the version to update the components of the block.
Timestamp
It records the time when a block was created and the time of transaction approvals. Is in a unix time format and also plays key role when determining a nonce.
Previous Hash
It’s the hash of the previous block’s header similar to the previous hash in a linked list.
Merkle Root
Also called Binary Hash Tree, it is a data structure that summarizes all the transactions in a block, saves storage space and makes it more easier to track transactions.
Nonce
Number Used Only Once (NONCE), is a number that help miners solve the mathematical problem of generating a hash. It starts from 0 until the number where the targeted hash is achieved. Let’s understand it with a simple equation
You are given,
X+Y=10
And asked to find the value of Y but you don’t know X either, can you find Y? No, you can’t.
Now, if X is given as 4. and sum of X+Y=10 then by simple logic Y=6, so
Here, consider X to be the Nonce, Y is the hash that the miner needs to find and 10 is the targeted hash value. When X is known we can easily find Y, same way Nonce(X) helps find the hash(Y).
Hope it was worth your time.
We at Blocktrain are on a mission to teach Blockchain and Web3 in the most easiest language. Do check out our website for resources and roadmaps
Learn Solidity in Hindi