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?
2 Answers
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; };
-
-
1@Fyde yes, both use the same Ethereum protocol, for the moment... Commented Jan 15, 2017 at 9:37
-
care to explain what's the purpose of this line? var ethPerMin = blocksPerMin * 5.0; Commented Oct 26, 2017 at 0:33
-
1answering myself: 1 block = 5 ETH rewards although this might not be the case forever Commented Oct 26, 2017 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. Commented Feb 4, 2018 at 20:30
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.