Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: fevir on September 27, 2016, 08:25:22 PM



Title: Largest number of blockchain-heads (single fork) ever observed?
Post by: fevir on September 27, 2016, 08:25:22 PM
Hi All,

A fork occurs when two or more miners separately create a block at approximately the same time. The Bitcoin blockchain then (temporarily) consists of two or more blockchain heads.

This site (http://bitcoin.stackexchange.com/questions/3343/what-is-the-longest-blockchain-fork-that-has-been-orphaned-to-date) shows the length of the longest fork created on the Bitcoin blockchain.

However, if two miners separately create a block, a two-headed blockchain appears. If n-miners separately create a block, an n-headed blockchain appears. What is the largest value of n ever observed on the Bitcoin blockchain?

And is there a source where one can observe the average fork-height (n) of the Bitcoin blockchain?

Thanks,
Fevir


Title: Re: Largest number of blockchain-heads (single fork) ever observed?
Post by: achow101 on September 27, 2016, 08:43:52 PM
Bitcoin Core keeps track of all blocks that it receives, including these stale blocks and chain reorgs. If you use the RPC command getchaintips, you will be able to see all of the possible blockchain tips that your node knows of. Thus you can check to see how many stale blocks of the same height there are.


Title: Re: Largest number of blockchain-heads (single fork) ever observed?
Post by: fevir on September 28, 2016, 06:26:17 PM
Hi,

Thanks for your reply. Indeed, the 'bitcoin-cli getchaintips' command seems to be working.

Just to make sure to get it right, if I perform a (on Linux):
bitcoin-cli getchaintips | grep height | <some sed here, leaving only the numerical height> > <file>
and,
sort <file> | uniq -c | head

should provide an overview of the top 10 largest stale blocks of the same height?


Title: Re: Largest number of blockchain-heads (single fork) ever observed?
Post by: achow101 on September 28, 2016, 06:34:02 PM
Hi,

Thanks for your reply. Indeed, the 'bitcoin-cli getchaintips' command seems to be working.

Just to make sure to get it right, if I perform a (on Linux):
bitcoin-cli getchaintips | grep height | <some sed here, leaving only the numerical height> > <file>
and,
sort <file> | uniq -c | head

should provide an overview of the top 10 largest stale blocks of the same height?
I think you need another sort after uniq in order to have it in order of most stale blocks for a height.


Title: Re: Largest number of blockchain-heads (single fork) ever observed?
Post by: fevir on October 06, 2016, 01:59:21 PM
After some testing, yes, it needed another sort, thanks.

However, I seem to be getting only a single chain tip (the latest block), probably because I'm connected to a single node only. This is my output:
$ bitcoin-cli getchaintips
[
  {
    "height": 432407,
    "hash": "0000000000000000015ef5f0c0aba9e0697b38010b50eb0beaf7f795416440a6",
    "branchlen": 0,
    "status": "active"
  }


As an open question, what is the maximum number of Bitcoin blockchain tips (single fork) you ever observed?