ethstats has this statistic, currently at 48.3TH/s, but how do they determine it? Are hashrates reported by nodes added up and averaged over so many blocks?
1 Answer
While I can't tell you how ethstats calculates the average network hash rate, I can tell you that they almost certainly don't use reported values from nodes. Firstly, it would be difficult for them to connect to all nodes. This would be okay if they were to connect to all the nodes with substantial mining capacity, but I don't think all nodes report a speed.
More likely, and the way I would calculate it, is to look at the average difficulty (this is baked into the blocks themselves) and the average time to solve a block. Since the expected time to solve a block is difficulty / hash rate
(this relationship can be derived from the Ethereum source code), one can solve, algebraically, and find that the network hash rate is the average difficulty divided by the average block time. Then you just need to pick your window in terms of number of blocks used for computing the average. For example, right now, the difficulty is ~1240TH - which means that one successful hash is expected to be found every 1240 trillion hashes. Since the average block time is roughly 18.9s, the current network hash rate is roughly 65TH/s.
-
Ethstats require nodes to register, so it's not all nodes. (just adding to your answer) Commented Aug 16, 2017 at 11:13