# How do I calculate expected earnings when mining a cryptocurrency? [duplicate]

If I have access to currency-specific variables/datasets for any cryptocurrency of choice (see below), how would I calculate which cryptocurrency (out of a fixed set of say 3-5 altcoins -- SHA-256 and Scrypt only) would be most profitable to mine at a given time?

Given: difficulty, hash rate (network), block count, block time, block reward, exchange rate, and exchange volume.

To be more specific, I'm wondering what math would go into calculating Expected Earnings/(MH/sec) for each cryptocurrency with this data? I'm not not necessarily asking for something like http://www.coinwarz.com/cryptocurrency/ that takes your own device's hash rate and power consumption:power cost ratio to determine individual profitability, I'm talking about a general calculation where the output is in the units 'Expected Earnings/(MH/sec)'

(I'm not sure how complicated a calculation like this is, so I'm not asking for exact math or anything just where/how to start with a problem like this)

Calculate your share of the network hash rate for that particular hash algorithm (your hash rate divided by the network hash rate), let that be HR.

Calculate the emission by unit of time (block reward times 86400 divided by block time in seconds), let that be E.

Calculate your expected average coins mined in a day (HR times E), let that be C. Note that variance will be high, unless you mine on a large pool, or have a large HR.

Calculate the price in the coin you want to convert to (C divided by exchange rate, or C times exchange rate, depending on whether it's expressed by altcoin per bitcoin, or bitcoin per altcoin, respectively).

If you want per second, or per MH, scale accordingly.

• How would difficulty be factored into this? – user37509 Jun 11 '16 at 15:25
• Difficulty is a scaled version of the network hash rate over a window of the last N blocks (typically). Assuming difficulty retargets often enough, there's close to no lag. For small hash rate coins, it might make a difference if the network hash rate varies wildly intraday though. – user36303 Jun 11 '16 at 15:51
• How is the answer you provided different from [(S/(D*4295))*86400*R*P], where S is your hash rate (in MH/sec), D is the difficulty rating, R is the block reward, and P is the price in USD of a single coin? This seems to be the standard formula for determining average profit per day. (Sorry to be asking so many questions here, just new to the topic in general) – user37509 Jun 12 '16 at 20:02
• It looks pretty similar, except the 4295 which seems a bit out of place. That might be a particular coin's difficulty vs network hash rate's scale. Typically, the difference is the block time (ie, difficulty = block time times hash rate), but a block time of 4295 would be uncommon, but maybe some coins have a different scaling there. – user36303 Jun 12 '16 at 21:56
• The 4295 is an approximation of (2^32)/1000000 (which is 2^32 adjusted for 1MH/sec)––I believe the calculation for difficulty is [(block time * hash rate)/2^32], except this is scaled to MH/sec in this case. – user37509 Jun 13 '16 at 2:28

Look at this and just use the same terms for other altcoins https://en.bitcoin.it/wiki/Mining