Correcting the error in getnetworkhashrateps

Posted by zawy

Jun 29, 2025/14:43 UTC

In the exploration of hashrate estimation, a crucial correction was made regarding the use of Erlang distribution for calculating expected values. The core of this correction lies in the understanding that estimating hashrate, which inherently includes time in its denominator, necessitates the employment of the expected value of the inverse of an Erlang-distributed random variable, rather than simply using the inverse of the expected time. This distinction is vital because the mathematical expectation of the inverse of a variable (E[1/T]) does not equate to the inverse of its expected value (1/E[T]), leading to inaccuracies in calculations if not properly addressed.

To delve deeper, hashrate estimation involves several parameters: T represents the timespan, k (also referred to as N or n) denotes the number of blocks, λ stands for the rate parameter, defined as 1 divided by the mean block time, and W symbolizes sipa's sum of work. The corrected approach for deriving the expected value of the inverse of the timespan (E[1/T]) is represented as λ/(k-1) for k greater than 2, as per Grok's methodology. Furthermore, the estimated λ can be calculated as k/T following two methodologies: directly from Erlang’s λ as k / E[T], and from the Maximum Likelihood Estimation (MLE) for Poisson distribution.

The final piece to accurately measuring hashrate is acknowledging the inherent bias in the initial calculation of E[W/T] = W * E[1/T]. To rectify this and achieve an unbiased estimation of hashrate (W/T), it is necessary to adjust the calculation by multiplying by (k-1)/k. This adjustment ensures that the final hashrate measurement reflects true values by compensating for the discrepancy between 1/E[T] and E[1/T], thereby providing a more accurate and reliable measurement of the hashrate.

Link to Raw Post
Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from authoritative bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiBitcoin Transcripts Review
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project?

Give Feedback