Understanding Orphaned Blocks in Cardano's Ouroboros Praos
What are Orphaned Blocks?
In the Ouroboros Praos system used by Cardano, there is something called an "Orphaned Block." Imagine building a tower out of blocks, but then having someone come along and knock out the block you just placed. That's similar to what happens with an orphaned block - it's a block that was created but then rejected by the network and doesn't count towards a stake pool's performance.
How do Orphaned Blocks Happen?
There are two main reasons why a block might be orphaned: a "Slot Battle" and a "Height Battle."
In the Ouroboros Praos system used by Cardano, each stake pool competes to be the leader for a specific slot. Think of it like a race, where each stake pool is running to reach the finish line first. Each stake pool uses their own private key to verify that they are the leader of that slot.
Sometimes two or more stake pools might finish the race at the same time, which is called a "Slot Battle." Imagine two people crossing the finish line of a race at the same time, now the network has to decide which person is the winner. In Ouroboros Praos, the network decides by using the VRF proof value, however, after the Vasil hardfork the chance to win the slot battle is set to 50:50, regardless of the VRF proof value.
Imagine you're building a tower out of blocks and you have to pass the block to the next person to build their part of the tower. If the next person doesn't get the block in time, they'll build their part of the tower with a different block and your block will be rejected and not used. That's similar to what happens in a height battle.
When two blocks are created at the same time and have the same block number, the network will choose the block with the higher slot number and reject the other block. Picture two people trying to build a tower simultaneously and both of them sends the same block number, but at different slots, the network will choose the person who finishes later and reject the other person's block.
How to Avoid Orphaned Blocks?
To avoid a height battle, it's important that the block is propagated through the entire network quickly. The ideal time is within one second (1s), since the length of a slot on Cardano is one second. This way, you can ensure that the next person building the tower will have your block and build on top of it.
To propagate a block quickly, you need a large enough diversity of peers who are also connected to other peers. Currently, the way Cardano's network works is that you have to manually add the connections to other computers (called "peers") instead of the network finding them automatically. But having too many peers can also slow down the node's processing ability to propagate the block due to management of too many peers. It's best to have around 20 or fewer connections to other computers (called "peers") for each computer (called "node") on the network.
In summary, orphaned blocks are blocks that were created but then rejected by the network. Orphaned blocks don't help a stake pool earn rewards and don't count when figuring out how well the stake pool is doing. Two main reasons for these blocks to be orphaned are slot battle and height battle, which can be thought of like races or building towers.
In the case of slot battles, the network uses the VRF proof value to decide the winner, however, after the Vasil hardfork, the chance to win the slot battle is set to 50:50, regardless of the VRF Proof value. In order to avoid height battle, it's important to propagate blocks quickly and have the right amount of peers.