Author Topic: Prediction on mining difficulty over time  (Read 4377 times)

Offline bajanboost

  • Jr. Member
  • **
  • Posts: 24
Prediction on mining difficulty over time
« on: April 06, 2013, 01:34:28 AM »
Is there anywhere I can find mathematical relationships for  Litecoins which relate difficulty, hashrates, exchange rates and the like?

Im trying to make some accurate profitability predictions which dont involve fitting straight lines to what are, in fact, curves.

Offline Explicit

  • Jr. Member
  • **
  • Posts: 37
Re: Prediction on mining difficulty over time
« Reply #1 on: April 06, 2013, 07:48:04 AM »
While it sure is possible to estimate the next difficulty level, I don't think that it is possible to predict it for longer time periods, so as to estimate profitability of your investment.
I don't say that it can't be done, I am just saying that it can't be simply predicted in a form of a simple trend. As far as I understand increasing/decreasing difficulty is used to control the amount of coins produced. The statistical model for making long term prediction would necessarily involve prediction regarding the total hasharte, and to predict that some “soft” data should be included in the model, such as anticipations of the individual 'players' regarding the future events. I can immagine that it would be a very complex model, which would easily fail in prediction every time when something unexpected happens. I think that a rule of thumb could serve you equally well. To make it short: difficulty will increase :)

Offline Explicit

  • Jr. Member
  • **
  • Posts: 37
Re: Prediction on mining difficulty over time
« Reply #2 on: April 06, 2013, 07:57:46 AM »
Regarding the prediction of exchange rates.
Curves? Are they? I don't think so. If they appear as curves to you, apply a transformation, e.g. log transform it, and you'll get approximately straight line - but in my opinion the data does not exhibit curve properties; the data jumps up and down. To make it short: it is impossible to predict. There is a HUGE amount of volatility involved.

Offline live627

  • Full Member
  • ***
  • Posts: 210
Re: Prediction on mining difficulty over time
« Reply #3 on: April 06, 2013, 08:18:56 AM »
I'm basing my mining returns on a difficulty of 600.
LdqQwaUCJqWCwwH6kzagZfsmRP1Jt25er1

Offline gfoot

  • Jr. Member
  • **
  • Posts: 165
Re: Prediction on mining difficulty over time
« Reply #4 on: April 06, 2013, 01:45:38 PM »
Your expected return, during a run of 2016 blocks (about 3 days) is:

expected_return = 50 LTC/block * 24 blocks/hour * your_hashrate / network_hashrate

To be clear, this network hashrate is the software's estimate of the network hashrate over the course of the previous 2016-block run.  It doesn't actually store that though, it stores "nBits", which is commonly reported as a floating-point difficulty number, such that:

network_hashrate = difficulty * 2^32 / 150s

so you can simplify that first equation down to:

expected_litecoins_per_hour = your_hashrate_in_kH_per_s / difficulty * 0.0419

or, to within 1%, expected_litecoins_per_day = your_hashrate_in_kH_per_s / difficulty

Again, this difficulty is nailed down at the start of each 2016-block run, and the equation holds for the rest of the run, regardless of changes to your hashrate during the run.

So written this way, the trick is predicting future difficulty changes.  The most direct way is to keep an eye on the block generation rate and run through the difficulty recalculation algorithm yourself, which is quite simple.  At the end of each 2016-block streak, it looks at the time it took to generate all those blocks, and divides 2016 by it to work out the actual block generation rate, then adjusts the old difficulty linearly to compensate for the error.  Effectively it picks a difficulty which would have made the previous 2016-block run complete in the right amount of time.

For example, take the 153-difficulty sequence which ended this morning:

Last block time: 2013-04-06 01:10:35
Last block of previous run: 2013-04-03 10:39:05
Total time for 2016 blocks: 3751.5 minutes
Average time per block: 1.86 minutes
Drift factor: 2.5 / 1.86 = 1.34
New difficulty: 1.34 * 153 = 205

If you're running this calculation yourself before the end of a run, e.g. using the last 100 blocks as a guide, then make sure the sequence of blocks you use all have the same difficulty value (i.e. they don't cross a 2016-block boundary).  You can use this calculation to get unstable short-term readings or more stable medium-term readings, depending how many blocks you look at.  The best estimate for the next difficulty will come from using all of the blocks since the start of the current 2016-block run.

In the end though statistics can help you find trends in past data, but guessing the future is up to the economists.  Economics is about models, not truth, and there's no one correct model.  So this is about as far as you can go with strict equations.

The future network hash rate fluctuates according to profitability of mining; also bear in mind the time it takes a new miner to get equipped, which will cause some lag in the hash rate's response to exchange price fluctuations for example.  There's also a varying degree to which miners pay attention to the true costs of their operations, e.g. power costs, whether it's worth running on obsolete hardware, whether they have the ready cash to upgrade, etc.

And of course there's the predicted flood of bitcoin miners who may or may not switch to litecoin if ASICs lead to diminishing returns for them in the bitcoin market, and if litecoin's exchange rate stabilizes high.

Then, what happens if the litecoin rate drops - will people stop mining?  Or will they leave their rigs on anyway, now that they're set up, hoping for a future rise?

There are lots of things you can model, and you really need to think about it before deciding which factors to include.
« Last Edit: April 11, 2013, 04:02:32 AM by gfoot »
BTC: 14ciemcbiGQ328NUTUz7j4wZ2tKy998C4a
LTC: LMUo6xEJZtPsNDpZe2QLEzmK1eW4tYZNLF

Offline willzell

  • Newbie
  • *
  • Posts: 7
Re: Prediction on mining difficulty over time
« Reply #5 on: April 06, 2013, 03:28:59 PM »
Is it still profitable to mine on a home computer?

Offline live627

  • Full Member
  • ***
  • Posts: 210
Re: Prediction on mining difficulty over time
« Reply #6 on: April 06, 2013, 04:57:15 PM »
Yes
No










... you seriously expected a straight answer? :D
LdqQwaUCJqWCwwH6kzagZfsmRP1Jt25er1

Offline xk5

  • Newbie
  • *
  • Posts: 8
Re: Prediction on mining difficulty over time
« Reply #7 on: April 06, 2013, 10:37:09 PM »
Is it still profitable to mine on a home computer?

Sure, depending on the current exchange rate, and depending on the hardware... a Radeon 7950 mines about 550kH/s a day, that's a little under 3 LTC/day at current difficulty.

Offline decryption

  • Jr. Member
  • **
  • Posts: 21
Re: Prediction on mining difficulty over time
« Reply #8 on: April 10, 2013, 05:24:45 AM »
expected_litecoins_per_day = your_hashrate_in_kH_per_s / difficulty * 0.0419

Very useful post! But is this correct?

(23,000kH/s / 235) * 0.0419 = 4.1008510638 LTC/day

but when I put the same numbers into the calculator here: http://www.litecoinpool.org/calc - I get 98.44277767 LTC/day - quite a large difference!

Offline Sy

  • Global Moderator
  • Hardcore Member
  • *****
  • Posts: 4036
Re: Prediction on mining difficulty over time
« Reply #9 on: April 10, 2013, 03:14:06 PM »
Current increase was around 16% the last two or three times, it will go up alot once BFL ships their asics but a well, just wait and see :D

Offline Malak

  • Sr. Member
  • ****
  • Posts: 570
Re: Prediction on mining difficulty over time
« Reply #10 on: April 10, 2013, 04:09:38 PM »
Current increase was around 16% the last two or three times, it will go up alot once BFL ships their asics but a well, just wait and see :D

Are you saying that just because BTC miners will switch to LTC if they don't have ASICs, or will their machines actually be able to do LTC also?
LTC: LdxgJQLUdr8hZ79BV5AYbxkBUdaXctXAPi

Kamikaze Game: http://litecoinkamikaze.com/ref/8317

Offline chumpyy

  • Newbie
  • *
  • Posts: 1
Re: Prediction on mining difficulty over time
« Reply #11 on: April 10, 2013, 11:29:44 PM »
Hey gfoot, care to go over those equations some more? Either I am doing something serious wrong or there is something wrong in the equations.

Specifically, in the simplified equation:
expected_litecoins_per_day = your_hashrate_in_kH_per_s / difficulty * 0.0419

e.g.
As xk5 mentioned, a 7950 should get 550 kh/s which should return a little under 3 ltc/day at a difficulty of 153
expected_litecoins_per_day
= your_hashrate_in_kH_per_s / difficulty * 0.0419
= 550 / 153 * 0.0419
= 0.1506 ltc /day

which is completley off....

Offline gfoot

  • Jr. Member
  • **
  • Posts: 165
Re: Prediction on mining difficulty over time
« Reply #12 on: April 11, 2013, 03:55:19 AM »
Sorry, I got mixed up - that equation was coins per hour, not coins per day.  I'll edit the post.

In fact with that correction it's even simpler - it seems that, to within 1%:

expected_litecoins_per_day = your_hashrate_in_kH_per_s / difficulty

The conversion factor is about 1.006.
« Last Edit: April 11, 2013, 04:05:16 AM by gfoot »
BTC: 14ciemcbiGQ328NUTUz7j4wZ2tKy998C4a
LTC: LMUo6xEJZtPsNDpZe2QLEzmK1eW4tYZNLF

Offline Sy

  • Global Moderator
  • Hardcore Member
  • *****
  • Posts: 4036
Re: Prediction on mining difficulty over time
« Reply #13 on: April 11, 2013, 06:02:18 AM »
Current increase was around 16% the last two or three times, it will go up alot once BFL ships their asics but a well, just wait and see :D

Are you saying that just because BTC miners will switch to LTC if they don't have ASICs, or will their machines actually be able to do LTC also?

Many will switch to LTC since the diff on BTC might become ridiculously high, FPGAs will stay, they are still profitable AND can't mine LTC so far anyway but all the countries with higher power costs will have to switch or sell their gear if ASICs hit as predicted, it's said that BFL will ship 90k Units...
« Last Edit: April 12, 2013, 04:38:35 AM by Sy »

Offline Joerii

  • Jr. Member
  • **
  • Posts: 24
Re: Prediction on mining difficulty over time
« Reply #14 on: April 11, 2013, 10:17:50 PM »
Your expected return, during a run of 2016 blocks (about 3 days) is:

expected_return = 50 LTC/block * 24 blocks/hour * your_hashrate / network_hashrate

To be clear, this network hashrate is the software's estimate of the network hashrate over the course of the previous 2016-block run.  It doesn't actually store that though, it stores "nBits", which is commonly reported as a floating-point difficulty number, such that:

network_hashrate = difficulty * 2^32 / 150s

so you can simplify that first equation down to:

expected_litecoins_per_hour = your_hashrate_in_kH_per_s / difficulty * 0.0419

or, to within 1%, expected_litecoins_per_day = your_hashrate_in_kH_per_s / difficulty

Again, this difficulty is nailed down at the start of each 2016-block run, and the equation holds for the rest of the run, regardless of changes to your hashrate during the run.

So written this way, the trick is predicting future difficulty changes.  The most direct way is to keep an eye on the block generation rate and run through the difficulty recalculation algorithm yourself, which is quite simple.  At the end of each 2016-block streak, it looks at the time it took to generate all those blocks, and divides 2016 by it to work out the actual block generation rate, then adjusts the old difficulty linearly to compensate for the error.  Effectively it picks a difficulty which would have made the previous 2016-block run complete in the right amount of time.

For example, take the 153-difficulty sequence which ended this morning:

Last block time: 2013-04-06 01:10:35
Last block of previous run: 2013-04-03 10:39:05
Total time for 2016 blocks: 3751.5 minutes
Average time per block: 1.86 minutes
Drift factor: 2.5 / 1.86 = 1.34
New difficulty: 1.34 * 153 = 205

If you're running this calculation yourself before the end of a run, e.g. using the last 100 blocks as a guide, then make sure the sequence of blocks you use all have the same difficulty value (i.e. they don't cross a 2016-block boundary).  You can use this calculation to get unstable short-term readings or more stable medium-term readings, depending how many blocks you look at.  The best estimate for the next difficulty will come from using all of the blocks since the start of the current 2016-block run.

In the end though statistics can help you find trends in past data, but guessing the future is up to the economists.  Economics is about models, not truth, and there's no one correct model.  So this is about as far as you can go with strict equations.

The future network hash rate fluctuates according to profitability of mining; also bear in mind the time it takes a new miner to get equipped, which will cause some lag in the hash rate's response to exchange price fluctuations for example.  There's also a varying degree to which miners pay attention to the true costs of their operations, e.g. power costs, whether it's worth running on obsolete hardware, whether they have the ready cash to upgrade, etc.

And of course there's the predicted flood of bitcoin miners who may or may not switch to litecoin if ASICs lead to diminishing returns for them in the bitcoin market, and if litecoin's exchange rate stabilizes high.

Then, what happens if the litecoin rate drops - will people stop mining?  Or will they leave their rigs on anyway, now that they're set up, hoping for a future rise?

There are lots of things you can model, and you really need to think about it before deciding which factors to include.

What an awesome post. You put into words what was vaguely crystalising in my mind the last few days. I sent you a 1 LTC tip :)