The parent-child relationship between blocks of a blockchain
Mini
Let’s take a deeper look at the block creation process and the parent-child relationship between each block in a blockchain.
To the unfamiliar, blockchain technology can seem extremely complicated. However, the basic principles are quite simple: new transactions are verified, grouped into blocks and added to the blockchain. All blocks in a blockchain follow a parent-child relationship and are linked to each other.
This entire chain of transaction data is distributed and visible to all network participants. Hence the term distributed ledger technology (DLT). Let’s take a deeper look at the block creation process and the parent-child relationship between each block in a blockchain.
How new blocks are added to a blockchain
So the big question is – how are blocks made? Let’s learn it with the example of Bitcoin. Bitcoin follows the proof-of-work consensus mechanism where hundreds of thousands of miners compete to solve a mathematical problem that requires tons of computational power. The first miner to find the answer to the mathematical problem is allowed to create a new block and is rewarded with 6.25 BTC for the effort.
Parent-child association
When a new block is created, its data is encoded and passed on to the next block. Therefore, each block contains a link to its predecessor, forming a family history similar to a family tree. Each new block is like a child that passes on a link to its parent block.
In the case of Bitcoin, this link can be traced back to the Genesis Block, the first block ever created on the Bitcoin network. The Genesis Block is the only block without a parent, like Adam and Eve from the Bible, which may explain the reason behind the name Genesis. Each block is a single child born to a single parent without exception.
What are orphan blocks?
As mentioned earlier, the first miner to solve the math problem gets the right to add a new block. Sometimes two miners solve the problem at the same time and create two blocks at the same time. However, according to blockchain guidelines, a parent block can only have one child. This creates a problem: which block is passed on and which is rejected and deleted?
The network nodes decide this. They create a small fork in the network and start adding consecutive blocks below the two duplicated blocks. Therefore, each of the two blocks ends up having its own family tree.
The fork also starts a race to see which family tree can verify and create the most blocks. The fork with more verified blocks is accepted into the blockchain. On the other hand, the block with the shorter chain is known as an orphan block and is discarded. All the verified blocks generated from the orphan block are sent back to the mempool, where they will be validated again and added to the new chain.
However, the term orphan block is a bit misunderstood. An orphan is a child without parents. Only the Genesis Block fits this description since it has no parent blocks. That’s why some blockchain faithful refer to these discarded blocks as obsolete blocks rather than orphaned blocks. However, for simplicity, unaccepted blocks are generally referred to as orphan blocks. Also, the miner who creates an orphaned block usually receives no reward.
Conclusion
This parent-child relationship applies to most blockchains. However, when it comes to dealing with orphaned blocks, some blockchains have adopted different techniques. For example, Polkadot has a coding agreement called GRANDPA (GHOST-based Recursive ANcestor Deriving Prefix Agreement) that determines which child block to keep and which to discard.
On the other hand, Ethereum uses the GHOST (Greedy Heaviest Observed SubTree) protocol to determine what happens to orphaned blocks. But in any case, two blocks created at the same time is a problem that must be dealt with before the blockchain can continue.