Bitcoin Forum
December 12, 2024, 04:53:03 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can someone please explain what causes orphans like I'm five?  (Read 1562 times)
Jaxkr (OP)
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


View Profile
July 22, 2013, 11:20:48 PM
 #1

I've heard that they're caused when two block are found extremely close to each other. But I've seen block that were a minute apart and weren't orphaned.
What happens in the code that causes a block to be pegged as an orphan?
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4284
Merit: 8816



View Profile WWW
July 23, 2013, 12:13:13 AM
 #2

The purpose of the bitcoin blockchain is to assign an order to all transactions that everyone can agree on. This is hard because we don't want to have a central party that coordinates the ordering.

To solve this problem Bitcoin participants called miners do a computer equivalent of rolling dice to determine when they're permitted to produce a block. The blocks form a long chain— every block with one block before it and one block after it—, and the order of the chain gives the transactions inside order.  Everyone adjusts their dice odds to keep the blocks found infrequently enough that everyone isn't finding one at the same time, and everyone (even non-miners) checks to make sure everyone else is following these rules.

Sometimes— by pure chance— two miners will produce blocks in very rapid succession, the second happening before the miner had a chance to hear about the first. The closer the blocks are found to each other the more likely it is that they are siblings rather than one the parent of the other, this is called a fork in the chain. Only one of these sibling blocks can be kept because both are marked as coming directly after the block before them and the chain must be straight if we are to use it to order transactions.

When there is a (near) tie like this Bitcoin nodes prefer the first block they heard, but some may have heard the second block first because the messages take time to relay, and we need to get all nodes to agree.  Ultimately all the Bitcoin nodes decides which of the blocks to keep based on which one ends up in the longer list of blocks because this is evidence that more participants preferred that block. Sometimes several blocks must be produced before it is clear which of two competing block forks will be the winner and during that time the final answer is unclear.  Once one fork becomes clearly longer the nodes preferring the other fork will switch to using the blocks in the longer chain, potentially undoing transactions and replacing them with other ones.

The losing block is called an orphan block. The name "orphan" is a little misleading because an orphan block has a parent.  This name became common because the transaction which generates the new coin in that block doesn't have a parent in the blockchain and so that transaction is fairly called an orphan. But the Bitcoin software only way of telling you that you'd found a block which lost was to tell you about the orphan transaction and the name stuck.

Orphans are a regular part of the Bitcoin process and cannot be avoided. They happen pretty much every day and are normally harmless.
Jaxkr (OP)
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


View Profile
July 23, 2013, 12:17:18 AM
 #3

Very clear explanation! Thank you very much! Smiley
jarhed
Sr. Member
****
Offline Offline

Activity: 672
Merit: 254


View Profile
July 23, 2013, 01:00:28 AM
 #4

"there can only be one"
greyhawk
Hero Member
*****
Offline Offline

Activity: 952
Merit: 1009


View Profile
July 23, 2013, 08:54:41 AM
 #5

When Mommy and Daddy get shot in a poorly lit alleyway by a mugger in the rain after visiting the opera, the result is an orphan. The orphan later falls down a bat-infested well and breaks his neck. The end.
Akka
Legendary
*
Offline Offline

Activity: 1246
Merit: 1001



View Profile
July 23, 2013, 09:20:47 AM
 #6

When Mommy and Daddy get shot in a poorly lit alleyway by a mugger in the rain after visiting the opera, the result is an orphan. The orphan later falls down a bat-infested well and breaks his neck. The end.

Wait, that's not true. In the story I have herd the orphan survives the fall and from there on wears a ridiculous costume and brings his revenge to the muggers.

All previous versions of currency will no longer be supported as of this update
greyhawk
Hero Member
*****
Offline Offline

Activity: 952
Merit: 1009


View Profile
July 23, 2013, 09:44:27 AM
 #7

When Mommy and Daddy get shot in a poorly lit alleyway by a mugger in the rain after visiting the opera, the result is an orphan. The orphan later falls down a bat-infested well and breaks his neck. The end.

Wait, that's not true. In the story I have herd the orphan survives the fall and from there on wears a ridiculous costume and brings his revenge to the muggers.

That sounds ridiculous. Like something straight from out of a comic book.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!