4

As far as I know, a miner begins creating a new block as soon as it receives a valid block from another miner. It then begins to construct and hash the next block on top of the block it just received.

However, in case of existence of orphan blocks, I suppose it starts mining after processing orphan blocks, right? Can anyone tell when exactly a miner would start working on a new block?

5

A stale block (also often confusingly referred to as 'orphan block') occurs when two competing blocks were found and then another block builds on top of one of them.

See the following minimal example: the blocks B1 and B2 were discovered at the same time and then the discovery of block C clarifies that B2 is part of the chain with the most difficulty ("longest chain"). At this point B1 becomes obsolete, as it is not part of the best chain.

      B1
A ->
      B2 -> C

So, a miner would have received block A, then started to work on finding a successor to that. When B1 and B2 appeared, he would have received one of them first and started building on top of it, ignoring the other as not part of its best chain. When C appeared, the miners that were trying to build on top of B1 reorganize to B2 -> C and start building on C.

At no point would you process a stale block because once it is clear that the block is stale, it must already be part of an alternative chaintip that is not the longest chain. — There is no reason for you to be interested in it anymore. Especially, there is no reason to start mining on top of a stale block, as you'd be wasting your mining power trying to extend a stale branch of the blockchain (unless you're trying some sort of majority or selfish mining attack).

Actual orphan blocks, i.e. blocks where you're missing the parent block, should not occur by accident on the network as the miner that discovered the last block would be interested in spreading the parent block in order to collect the reward. However, when the parent becomes known, it's not an orphan block anymore. ;)

On the other hand, if a block is not connected to the blockchain at all, it's simply going to be treated as an invalid block by all other network participants.

  • Apparently I misunderstood the orphan blocks. I thought that they were like oprhan transactions, if there is a block that cannot be connected to the blockchain because of a missing block in between. İs such a case possible? Or nodes never have such situations and blocks can always be connected to the chain without any problem? – Önder Gürcan Jun 1 '17 at 20:53
  • I've updated my answer. – Murch Jun 1 '17 at 22:14
  • Protocol rules of BitCoin says that (in message "block" bullet 11): Check if prev block (matching prev hash) is in main branch or side branches. If not, add this to orphan blocks, then query peer we got this from for 1st missing orphan block in prev chain; done with block. – Önder Gürcan Jun 2 '17 at 12:10
  • @ÖnderGürcan: What is your question? That is consistent with what I wrote above. Today orphan blocks basically don't occur anymore, since we have header first synchronization and the network is pretty well connected. It's just highly uncommon that you would receive a successor block before it's parent. – Murch Jun 2 '17 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.