Bitcoin Forum
December 25, 2024, 12:00:32 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Difficulty and next estimate help, I would like this info on my own site...  (Read 1286 times)
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
December 28, 2013, 07:14:40 PM
 #1

Ok, so first check out this site: http://bitcoincharts.com/

Notice the following top left ?

Difficulty 1,180,923,195
Estimated 1,344,395,037 in 765 blks

Well, I asked the staff of that site if they could tell me the code used to produce this info and this is the reply I got.

Quote
It's the same algorithm used in bitcoin-qt to calculate the next
difficulty. You can find bitcoin-qt's source code on github.

So I looked on github and found a lot of things mentioning bitcoin-qt.

Anyway, as to the reason I am here...

If anyone can help me get this info displayed on the sites of mine I'd like it dpsplayed on without having it scraped from an existing site even if it means me hosting some bicoin client on my server I'd greatly appreciate it, Ty.

To be decided...
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
December 28, 2013, 10:47:12 PM
 #2

A basic estimate, which I believe Bitcoincharts also uses, is to simply estimate the next difficulty based on the time spent on mining since the last diff change.

Suppose we're N blocks past the previous difficulty adjustment, and a time T (in seconds) has passed since the previous adjustment. The average time per block so far has been T / N. The target rate is 600 seconds per block and if during a period of 2016 blocks the generation rate was X% higher than that, the difficulty is adjusted upwards by X%. So you compute 600 / (T / N) = 600 N / T and you obtain the multiplier to predict the next difficulty.
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
December 28, 2013, 11:22:01 PM
 #3

A basic estimate, which I believe Bitcoincharts also uses, is to simply estimate the next difficulty based on the time spent on mining since the last diff change.

Suppose we're N blocks past the previous difficulty adjustment, and a time T (in seconds) has passed since the previous adjustment. The average time per block so far has been T / N. The target rate is 600 seconds per block and if during a period of 2016 blocks the generation rate was X% higher than that, the difficulty is adjusted upwards by X%. So you compute 600 / (T / N) = 600 N / T and you obtain the multiplier to predict the next difficulty.
Not quite the help I was looking for but ty, there has to be more than random guessing to the next est.

I say this because for two sites to use ehe same "random" math to guess the next est is not likely to happen.

http://www.bitcoindifficulty.com/

Has the same current and next est figures, except bicoincharts also has the in x blocks thing.

To be decided...
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
December 28, 2013, 11:34:51 PM
 #4

A basic estimate, which I believe Bitcoincharts also uses, is to simply estimate the next difficulty based on the time spent on mining since the last diff change.

Suppose we're N blocks past the previous difficulty adjustment, and a time T (in seconds) has passed since the previous adjustment. The average time per block so far has been T / N. The target rate is 600 seconds per block and if during a period of 2016 blocks the generation rate was X% higher than that, the difficulty is adjusted upwards by X%. So you compute 600 / (T / N) = 600 N / T and you obtain the multiplier to predict the next difficulty.
Not quite the help I was looking for but ty, there has to be more than random guessing to the next est.

I say this because for two sites to use ehe same "random" math to guess the next est is not likely to happen.

http://www.bitcoindifficulty.com/

Has the same current and next est figures, except bicoincharts also has the in x blocks thing.

It's far from random to compute the estimate this way. It's the most obvious way to estimate it and as the difficulty adjustment moves closer, the prediction becomes more accurate.

The "in XYZ blocks" statistic of bitcoincharts isn't an estimate, it's fully accurate since difficulty adjustments happen every 2016 blocks, it's easy to calculate how many blocks are left to the next jump. Bitcoindifficulty.com simply doesn't show this number.
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
December 29, 2013, 12:02:19 AM
 #5

A basic estimate, which I believe Bitcoincharts also uses, is to simply estimate the next difficulty based on the time spent on mining since the last diff change.

Suppose we're N blocks past the previous difficulty adjustment, and a time T (in seconds) has passed since the previous adjustment. The average time per block so far has been T / N. The target rate is 600 seconds per block and if during a period of 2016 blocks the generation rate was X% higher than that, the difficulty is adjusted upwards by X%. So you compute 600 / (T / N) = 600 N / T and you obtain the multiplier to predict the next difficulty.
Not quite the help I was looking for but ty, there has to be more than random guessing to the next est.

I say this because for two sites to use ehe same "random" math to guess the next est is not likely to happen.

http://www.bitcoindifficulty.com/

Has the same current and next est figures, except bicoincharts also has the in x blocks thing.

It's far from random to compute the estimate this way. It's the most obvious way to estimate it and as the difficulty adjustment moves closer, the prediction becomes more accurate.

The "in XYZ blocks" statistic of bitcoincharts isn't an estimate, it's fully accurate since difficulty adjustments happen every 2016 blocks, it's easy to calculate how many blocks are left to the next jump. Bitcoindifficulty.com simply doesn't show this number.
In any case, I apparently still need some bitcoin software or something on my VPS to at the very least grab current diff and the in x blocks figure.

That's where I go duuuh and drool.

I have the percentage code and everything else worked out.

Code:
if($context['user']['is_admin']){
$current_diff = 1180923195;
$next_est_diff = 1344959376;

if($next_est_diff >= $current_diff){
$diff_percent = '+';
$inc_or_dec = 'Increase';
}else{
$inc_or_dec = 'Decrease';
}

$diff_percent2 = $next_est_diff - $current_diff;
$diff_percent3 = $diff_percent2 / $current_diff;
$diff_percent4 = $diff_percent3 * 100;

echo '
<br />
Current Difficulty: '.number_format($current_diff).'<br />
Next Difficulty (Est.): '.number_format($next_est_diff).'<br />
'.$inc_or_dec.' by: '.number_format(abs($diff_percent2)).' ('.$diff_percent.''.number_format($diff_percent4, 2).'%)<br />
<font style="font-size: 11px;">(Next increase in 0,000 blocks.)</font>
';
}

Which displays this right now... mind you when the bioin stuff is addd, i would all change automatically when changes are detected in whatever bitoin stuff I need to install.

Current Difficulty: 1,180,923,195
Next Difficulty (Est.): 1,344,959,376
Increase by: 164,036,181 (+13.89%)
(Next increase in 0,000 blocks.)

To be decided...
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
December 29, 2013, 01:28:26 AM
 #6

In addition to he above...

In hindsight, why would the bitcoincharts people have suggested github when I just found out the official software from bitcoin.org is bitcoin-qt ?

Besides that, I downloaded it from bicoin.org but am now at a loss as to how to install it and run it so it can beggin to download the blockchain.

To be decided...
empoweoqwj
Hero Member
*****
Offline Offline

Activity: 518
Merit: 500


View Profile
December 29, 2013, 03:29:46 AM
 #7

In addition to he above...

In hindsight, why would the bitcoincharts people have suggested github when I just found out the official software from bitcoin.org is bitcoin-qt ?

Besides that, I downloaded it from bicoin.org but am now at a loss as to how to install it and run it so it can beggin to download the blockchain.

Because the official source code repository is at github. So if you want to see the official source you can. He was being helpful Smiley
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
December 29, 2013, 04:51:10 AM
 #8

In addition to he above...

In hindsight, why would the bitcoincharts people have suggested github when I just found out the official software from bitcoin.org is bitcoin-qt ?

Besides that, I downloaded it from bicoin.org but am now at a loss as to how to install it and run it so it can beggin to download the blockchain.

Because the official source code repository is at github. So if you want to see the official source you can. He was being helpful Smiley
Ahh, well... I ha a look at the DL from the bitcoin.org site, chose the linux package because that's what my Cloud VPS is running with cPanel. In any event, I'm at one hell of a loss... looks like I'll never get this done unless I fork over some cash to someone trustworthy enough to muck around on my server.

To be decided...
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
January 02, 2014, 03:22:38 AM
 #9

Ok, so I was looking in to this more and I should be able to pull it off myself but it seems the full node software on bitcoin.org requires Qt4. So with that said where can I get the Qt4 runtime libraries for a CentOS distribution ?

Quote
root@server [~]# cat /proc/version
Linux version 2.6.32-358.18.1.el6.x86_64 (mockbuild@c6b10.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Wed Aug 28 17:19:38 UTC 2013

Quote
root@server [~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

To be decided...
Abdussamad
Legendary
*
Offline Offline

Activity: 3710
Merit: 1586



View Profile
January 02, 2014, 03:56:20 AM
 #10

Ok, so I was looking in to this more and I should be able to pull it off myself but it seems the full node software on bitcoin.org requires Qt4. So with that said where can I get the Qt4 runtime libraries for a CentOS distribution ?

Quote
root@server [~]# cat /proc/version
Linux version 2.6.32-358.18.1.el6.x86_64 (mockbuild@c6b10.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Wed Aug 28 17:19:38 UTC 2013

Quote
root@server [~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

It's very simple:

- the daemon process is bitcoind. You'll find in the bin subdirectory right alongside -qt
- bitcoind does NOT require a GUI. It's command line only.
- You connect to bitcoind via jsonrpc. This is easily done in PHP. Use the getinfo commmand to get the latest difficulty stats.
- the hardest problem is the resource requirements of bitcoind/-qt. Both require a complete download of the blockchain, meaning gigs of disk space, and they use up quite a bit of ram - at least 512MB.

I suggest bootstraping bitcoind using the torrent download or it'll take forever to download and verify the blockchain. You'll find the torrent in the sourceforge repo.
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
January 02, 2014, 04:08:38 AM
 #11

Ok, so I was looking in to this more and I should be able to pull it off myself but it seems the full node software on bitcoin.org requires Qt4. So with that said where can I get the Qt4 runtime libraries for a CentOS distribution ?

Quote
root@server [~]# cat /proc/version
Linux version 2.6.32-358.18.1.el6.x86_64 (mockbuild@c6b10.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Wed Aug 28 17:19:38 UTC 2013

Quote
root@server [~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

It's very simple:

- the daemon process is bitcoind. You'll find in the bin subdirectory right alongside -qt
- bitcoind does NOT require a GUI. It's command line only.
- You connect to bitcoind via jsonrpc. This is easily done in PHP. Use the getinfo commmand to get the latest difficulty stats.
- the hardest problem is the resource requirements of bitcoind/-qt. Both require a complete download of the blockchain, meaning gigs of disk space, and they use up quite a bit of ram - at least 512MB.

I suggest bootstraping bitcoind using the torrent download or it'll take forever to download and verify the blockchain. You'll find the torrent in the sourceforge repo.
My knowledge of linux is so limited I'd screw things up trying to make sense of what you said, I would also prefer the GUI version over the command line one just for ease of use if I ever needed to get in to check, modify or upgrade something. It seems the GUI version is the one that needs the Qt4 livraries. That said, I have the ram and disskapce isn't an issue, last check the blockchain was something under 13gb and I have a hair over 20 available.

Basically all I have done so far is just download the linux version of Bitcoin-Qt from bitcoin.org and uploaded it to one of my websites folders.

Edit: FWIW, I wouldnt be looking to try and mine on my cloud, just host the full node to grav the info like current, next est difficulty and the block count til next increse like bitcoincharts.com has.

To be decided...
Abdussamad
Legendary
*
Offline Offline

Activity: 3710
Merit: 1586



View Profile
January 02, 2014, 04:32:53 AM
 #12

Well silly me there's an easier option. Just grab the info from blockchain.info. Very easy to do. Just curl this page in php:

https://blockchain.info/q/getdifficulty
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
January 02, 2014, 04:42:05 AM
 #13

Well silly me there's an easier option. Just grab the info from blockchain.info. Very easy to do. Just curl this page in php:

https://blockchain.info/q/getdifficulty
I'd raher host the info on my own site so not as to rely on other parties by means of scraping data or w/e.

I assume once I install w/e dependenies I need aside from the Qt4 libraries, that the following page (/full_path/bitcoin-node/src/INSTALL) will display more than just this...

Building Bitcoin See doc/readme-qt.rst for instructions on building Bitcoin-Qt, the intended-for-end-users, nice-graphical-interface, reference implementation of Bitcoin. See doc/build-*.txt for instructions on building bitcoind, the intended-for-services, no-graphical-interface, reference implementation of Bitcoin.

Either way, like I said... I know next to nothing about linux and installing dpendencies for programs. So even forgetting the data I want to pull. Just getting this thing going and start downloading the blockchain will take me a while assuming I ever can get it goin which is likely to never happen on my own unless someone whos done this before can quite literally hold my hand and walk me through it.

To be decided...
Abdussamad
Legendary
*
Offline Offline

Activity: 3710
Merit: 1586



View Profile
January 02, 2014, 04:54:45 AM
 #14

Well silly me there's an easier option. Just grab the info from blockchain.info. Very easy to do. Just curl this page in php:

https://blockchain.info/q/getdifficulty
I'd raher host the info on my own site so not as to rely on other parties by means of scraping data or w/e.

I assume once I install w/e dependenies I need aside from the Qt4 libraries, that the following page (/full_path/bitcoin-node/src/INSTALL) will display more than just this...

Building Bitcoin See doc/readme-qt.rst for instructions on building Bitcoin-Qt, the intended-for-end-users, nice-graphical-interface, reference implementation of Bitcoin. See doc/build-*.txt for instructions on building bitcoind, the intended-for-services, no-graphical-interface, reference implementation of Bitcoin.

Either way, like I said... I know next to nothing about linux and installing dpendencies for programs. So even forgetting the data I want to pull. Just getting this thing going and start downloading the blockchain will take me a while assuming I ever can get it goin which is likely to never happen on my own unless someone whos done this before can quite literally hold my hand and walk me through it.

Well first of all blockchain.info is not any old site and you are not scraping anything. That page is part of their API that they offer for free to anyone who wants to use it. See here:

https://blockchain.info/q

Now if you still insist on doing this without depending on third parties then I can do the work on your server if you throw a few coins my way Smiley PM me if you want that.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!