5

I know there are calculators for mining profit, but I need to include the same thing in an app I'm building, what formula do they use for Ethereum Classic? Also, can I use the same formula for other cryptocurrencies or is it different every time? Is there some website/guide/etc. that I can use to learn more about this?

4

Look at a calculator source code, there are some on github and you'll find the exact formula :

  $scope.ethPrice = ethereumStats.priceUsd;
  $scope.netHashGH = (ethereumStats.difficulty / ethereumStats.blockTime) / 1e9;
  $scope.blockTime = ethereumStats.blockTime;
  $scope.earnings = {};
  $scope.computeProfits = function() {
    var userRatio = $scope.userHash * 1e6 / ($scope.netHashGH * 1e9);
    var blocksPerMin = 60.0 / $scope.blockTime;
    var ethPerMin = blocksPerMin * 5.0;
    $scope.earnings.min = userRatio * ethPerMin;
    $scope.earnings.hour = $scope.earnings.min * 60;
    $scope.earnings.day = $scope.earnings.hour * 24;
    $scope.earnings.week = $scope.earnings.day * 7;
    $scope.earnings.month = $scope.earnings.day * 30;
    $scope.earnings.year = $scope.earnings.day * 365;
  };
  • Thanks, so it's the same for ETH and ETC? – Fyde Jan 15 '17 at 4:07
  • 1
    @Fyde yes, both use the same Ethereum protocol, for the moment... – Nicolas Massart Jan 15 '17 at 9:37
  • care to explain what's the purpose of this line? var ethPerMin = blocksPerMin * 5.0; – Luca Gibelli Oct 26 '17 at 0:33
  • 1
    answering myself: 1 block = 5 ETH rewards although this might not be the case forever – Luca Gibelli Oct 26 '17 at 0:41
  • 1
    @bshea it's 1e6 and 1e9, not 1e5. But I'll assume it's a typo ;) these ratios are used to convert your mining power called hashrate in the same unit. Network hashrate is always defined in Gh/s:giga hash per second and miner rate here is Mh/s: mega hash per second. So to have both in h/s you have to multiply each value by the multiplier of the corresponding unit prefix. giga is 1e9 and mega is 1e6. That's it. – Nicolas Massart Feb 4 '18 at 20:30
7

Here is rough formula:

<probability to mine next block> = <your hash rate> / <total hash rate>
<blocks in month> = <seconds in month> / <avg block time>
<blocks mined per month> = <probability to mine next block> * <blocks in month>
<revenue per month> = <block reward> * <blocks mined per month>
<earnings per month> = <revenue per month> - <expenses>

This calculation is only valid if you are mining in a pool.

Also, this is underestimation as it does not consider transaction fees and uncle blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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