How to calculate network hasrate from current difficulty?

Hi all,

As far as I know difficulty is some abstract value that affects number of calculations required to get new block.

Is there any formula that can be used to calculate actual (or actual for some custom point in past) hashrate of whole network? As far as I know for Monero it can be done with formula difficulty * 120 / seconds_for_block (120 here is hard coded value, estimated time for single block). Is there something similar for ZCash?

Not really as a block cannot be found in a set time - it could be pretty much immediately or take hours depending on the network hash rate.

If you are trying to calculate it to “do” something, why not look it up at: https://explorer.zcha.in/ - there is also an api at API - Zchain which you can use to return JSON with all the data.

1 Like

Sure, I understand that time required for one block depends on number of active miners and network hash rate.

My aim is to calculate average network hash rate during calculating custom block in past and, probably, to build chart of historical hash rate.

Take a look at this:
https://en.bitcoin.it/wiki/Difficulty

Thank you for link, that helped a lot in understanding of theory. Seems now I have to ensure that length of equihash result is same as for SHA-256 and find somewhere that magic “offset for difficulty 1” to calculate required number of hashes from current difficulty.

In case this helps, Here is how I calculate eth and etc…

My hashrate = 512M
Block Reward = 4.85
Eth Difficulty = 409407704069617
Eth price = 0.05083501
Etc Difficulty = 29302047027583
Etc price = 0.00340628
BTC price = 1700
Pool Take = 1%

ETH $/day
$44.83 = (512000000 * 4.85 ) / ( 409407704069617) * 0.99 * 86400 * (0.05083501*1700)

ETC $/day
$41.97 = (512000000 * 4.85 ) / ( 29302047027583 ) * 0.99 * 86400 * (0.00340628*1700)

From your formulas I can see that in case of ETH/ETC difficulty is just estimated number of hashes that should be calculated by network to find next block.

So to find hash rate of whole network during generation of custom block N, I should get difference between time stamp block N and block N-1 and divide it with difficulty of block N, should I?

If yes, what’s the rule for Zcash? I’ve found that for Bitcoin I should multiple result of that division with 2^32 and for Monero with 120. Seems for ETH/ETC we don’t need that coefficient (if your formula is correct). And what about Zcash?