Peercoin's blockchain fork detected from block #145785 - What happened there?

Hi guys,

I just found an orphan block of level 2 in my blockchain :-/:

[code]a_hashSHA256prevBlock: 000000000000000A9053FE6D5AA9A57EF72CB5373FE362A48CF44148148B1934
n_Time: Sat Nov 29 14:07:29 2014
a_hashCurrBlock: 1B87BA3E2E3A4AD63A6011A24C5595B3348DB28FD79E26E2F9CCBFCF2008D5BF
b_blockOrphan: false
n_blockHeight: 145785

a_hashSHA256prevBlock: 1B87BA3E2E3A4AD63A6011A24C5595B3348DB28FD79E26E2F9CCBFCF2008D5BF
n_Time: Sat Nov 29 14:14:43 2014
a_hashCurrBlock: 8294B1DD0590128F514FB1E1752156BC4A0D9A17B0E348FB2F7FFCB47C5CE422
b_blockOrphan: false
n_blockHeight: 145786

a_hashSHA256prevBlock: 1B87BA3E2E3A4AD63A6011A24C5595B3348DB28FD79E26E2F9CCBFCF2008D5BF
n_Time: Sat Nov 29 14:23:47 2014
a_hashCurrBlock: 489796430AED694741817A368095E54A3A04977003FFE4919DBE4443CBCDCBB6
b_blockOrphan: false
n_blockHeight: 145786

a_hashSHA256prevBlock: 8294B1DD0590128F514FB1E1752156BC4A0D9A17B0E348FB2F7FFCB47C5CE422
n_Time: Sat Nov 29 14:39:23 2014
a_hashCurrBlock: 770B49D5C8A5F3DCEA239A8EFC2C53C69DA7F05478F359039D17257FECC067BF
b_blockOrphan: true
n_blockHeight: Orphan (145787)

a_hashSHA256prevBlock: 489796430AED694741817A368095E54A3A04977003FFE4919DBE4443CBCDCBB6
n_Time: Sat Nov 29 15:13:56 2014
a_hashCurrBlock: 0000000000000007AA3624BBE6BB940A944318B13F44E61AE20E4CAEE88E1FA9
b_blockOrphan: false
n_blockHeight: 145787[/code]

From block #145785 I have a fork of the blockchain. The #145785 block is confirmed by two distinct blocks, and then these blocks are also respectively confirmed by two other blocks… Luckily one of them becomes Orphan so the fork stops here…

My questions are:

  • Why did this happen?
  • How can I detect that block 8294B1DD0590128F514FB1E1752156BC4A0D9A17B0E348FB2F7FFCB47C5CE422 is invalid (without considering the final Orphan)
  • What is the algorithm that decides which fork to go for?

forks of length=2 happens often. you don’t know until the network decides which branch to orphan.

Thanks mhps for the quick answer. How does the network decide and how fast does it do it?

I think the branch that has the most coinage wins. it takes 6 blocks for the decision to be final but usually if a block is confirmed by the network changing to another branch will need 1) someone still minting on the orphaned branch which is rare (most nodes stop after the first unconfirmation. Only determed minter or minters with a very long delay of network connection will do this) 2) this someone finds a block that burns more coindays than the confirmed brach combined 3) this someone doesn’t also put this new found block to the confirmed brach (i.e. not indiscriminately minting on all branches simply because doing so has “nothing at stake”). If the above all 3 are all done, the network will swith branch. The previous confirmed branch will become orphaned. So if a block is orphaned at the second block of a branch, it is more than 99% orphaned for good. That is why many exchanges only need 3 blocks to confirm a transaction.

I think the branch that has the most coinage wins. it takes 6 blocks for the decision to be final but usually if a block is confirmed by the network changing to another branch will need 1) someone still minting on the orphaned branch which is rare (most nodes stop after the first unconfirmation. Only determed minter or minters with a very long delay of network connection will do this) 2) this someone finds a block that burns more coindays than the confirmed brach combined 3) this someone doesn’t also put this new found block to the confirmed brach (i.e. not indiscriminately minting on all branches simply because doing so has “nothing at stake”). If the above all 3 are all done, the network will swith branch. The previous confirmed branch will become orphaned. So if a block is orphaned at the second block of a branch, it is more than 99% orphaned for good. That is why many exchanges only need 3 blocks to confirm a transaction.[/quote]

This is correct mhps, thank you very much for your help!

Indeed if someone is still minting/mining orphaned branch that could be an issue :(.