0

I'm trying to calculate the 24-hour rewards for ethash mining from the numbers at the WhatToMine JSON API.

For example, let’s say I want to calculate the 24-hour mining rewards for 1000 Mh/s ethash: the web GUI says the estimated 24-hour reward is 0.0303 eth,

Meanwhile, the API says:

{
"Ethereum": {
      "id": 151,
      "tag": "ETH",
      "algorithm": "Ethash",
      "block_time": "13.7541",
      "block_reward": 2.5419927147638,
      "block_reward24": 2.45464073212852,
      "last_block": 12928877,
      "difficulty": 7045283557960022,
      "difficulty24": 7052581432317500,
      "nethash": 512231520634576,
      "exchange_rate": 0.060053,
      "exchange_rate24": 0.0600458138222849,
      "exchange_rate_vol": 8376.33269589,
      "exchange_rate_curr": "BTC",
      "market_cap": "$276,000,383,779.77",
      "estimated_rewards": "0.00281",
      "estimated_rewards24": "0.00271",
      "btc_revenue": "0.00016849",
      "btc_revenue24": "0.00016253",
      "profitability": 100,
      "profitability24": 100,
      "lagging": false,
      "timestamp": 1627673948
    }
}

So how do I get 0.0303 from those numbers? I tried

// convert human-readable megahash to raw number of hashes
function MegaHashToHash(i){
    return i*1000000;
}
// convert human-readable megahash-per-second to raw number of hashes-per-24h
function MegaHashTo24h(i){
    return MegaHashToHash(i)*86400; // 86400 = seconds in 24 hours
}
MegaHashTo24h(1000)/(e.difficulty*e.block_reward)

And I get 0.00482437394924059, which is a far cry from the web GUI's calculations of 0.0303, so that calculation must be way off... What's the right way to calculate it?

An interesting observation, doing (MegaHashTo24h(1000)/(e.difficulty))*e.block_reward gives me 0.031173787222154928, which is much closer to the web GUI's 0.0303, but it's still off... And so far I'm just trying random combinations until I get something close to 0.0303.

1 Answer 1

1

You could roughly estimate the 24 hr reward as follows:

dailyReward = (your_hashrate / api.nethash) * api.block_reward24 * (6*60*24)

You need to multiply by 6*60*24 to convert the block reward to the total block rewards of a 24hr period, since a new ETH block is mined every 10 seconds. block_reward24 is safer to use than block_reward, since block_reward24 is the 24 hr average block reward. (your_hashrate / api.nethash) is your probability of mining the next block, so on average your daily income would be that probability multiplied by the total rewards of a 24 hr period.

6
  • thanks! but that number is significantly higher than the web gui's calculations, any idea where the difference comes from? the web gui estimate 0.0303 and ((your_hashrate=1000*1000000) / (api.nethash=512231520634576)) * (api.block_reward24=2.45464073212852) * (6*60*24) gives me 0.0414033402304427589069035775537486188113689422607421875000000000 (PS that number is from using IEEE754 Double precision 64-bit math which is not completely accurate, if i use a high-precision calculator instead i get 0.0414033402304427630106139372676180687679352422387414302835335438... which is )
    – hanshenrik
    Commented Jul 31, 2021 at 6:28
  • @hanshenrik are you sure it's not taking electricity costs into account? Commented Jul 31, 2021 at 15:21
  • no, electricity isn't it. however, every 10 seconds is just an approximate, for example, the time between block 12934234 and block 12934235 was 7 seconds, not 10 seconds, perhaps the web GUI calculates with higher accuracy with seconds-between-blocks than just 10 seconds between every block ? (hmm, that doesn't quite feel right either, i suspect the difference is something else)
    – hanshenrik
    Commented Jul 31, 2021 at 16:45
  • is it possible that whattomine considers time between blocks to be the "block_time": "13.7541", part of the response? ie 13.7 seconds between each block in that response ? instead of 10 seconds?
    – hanshenrik
    Commented Jul 31, 2021 at 16:53
  • 1
    @hanshenrik Yes, you're right about the block time. I somehow missed it. If we plug this into the calculation, we get a lot more precise result: (60*60*24/13.7541)*2.45464073212852*(1000*10^6/512231520634576) = 0.0301 ETH Commented Jul 31, 2021 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.