simon66 (OP)
|
|
January 16, 2012, 10:29:34 PM |
|
I'm currently working of a project and I need to know where can I find a reliable difficulty API? Like I found this one for BTC http://blockexplorer.com/q/getdifficultybut I need to get one for NMV and DVC. Thanks. PS. I'll keep searching.
|
|
|
|
Remember remember the 5th of November
Legendary
Offline
Activity: 1862
Merit: 1011
Reverse engineer from time to time
|
|
January 16, 2012, 10:57:40 PM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
|
BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
|
|
|
simon66 (OP)
|
|
January 16, 2012, 11:19:29 PM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
ummm. what? Lol
|
|
|
|
notme
Legendary
Offline
Activity: 1904
Merit: 1002
|
|
January 16, 2012, 11:21:24 PM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
This. bitcoind getdifficulty namecoind getdifficulty dvcoind getdifficulty (guessing on this one)
|
|
|
|
scintill
|
|
January 16, 2012, 11:22:25 PM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
ummm. what? Lol If you run bitcoind, namecoind, devcoind and keep them synced with the network, it's as easy as $ bitcoind getdifficulty 1250757.73927466
at the shell, or via HTTP RPC requests if you set that up.
|
1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
|
|
|
simon66 (OP)
|
|
January 17, 2012, 12:52:38 AM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
ummm. what? Lol If you run bitcoind, namecoind, devcoind and keep them synced with the network, it's as easy as $ bitcoind getdifficulty 1250757.73927466
at the shell, or via HTTP RPC requests if you set that up. I'm not so sure if the person I'm helping have that installed, how can I tell and how can I call it via php. Sorry if I'm asking too much.
|
|
|
|
payb.tc
|
|
January 17, 2012, 12:56:27 AM |
|
for nmc, you could try scraping this page: http://dot-bit.org/tools/nextDifficulty.php<h2>Namecoin difficulty</h2> <table cellpadding="0" cellspacing="0" class="liste"> <tr> <th></th> <th>Block</th> <th>Time</th> <th>Difficulty</th> <th>Ratio</th> </tr> <tr> <td style="text-align: left;"><abbr title="Last difficulty change">Last change</abbr></td> <td>38304</td> <td>16/01/2012 07:06</td> <td><abbr title="3'523.80GH/s">516'181.44</abbr></td> <td><abbr title="Based on elapsed blocks since last difficulty change">x1.04</abbr></td> </tr>
|
|
|
|
simon66 (OP)
|
|
January 17, 2012, 01:02:48 AM |
|
for nmc, you could try scraping this page: http://dot-bit.org/tools/nextDifficulty.php<h2>Namecoin difficulty</h2> <table cellpadding="0" cellspacing="0" class="liste"> <tr> <th></th> <th>Block</th> <th>Time</th> <th>Difficulty</th> <th>Ratio</th> </tr> <tr> <td style="text-align: left;"><abbr title="Last difficulty change">Last change</abbr></td> <td>38304</td> <td>16/01/2012 07:06</td> <td><abbr title="3'523.80GH/s">516'181.44</abbr></td> <td><abbr title="Based on elapsed blocks since last difficulty change">x1.04</abbr></td> </tr>
I was gonna do that, but there has to be an easier method. I'll wait on the "bitcoind getdifficulty" thingy
|
|
|
|
payb.tc
|
|
January 17, 2012, 01:16:55 AM |
|
for nmc, you could try scraping this page: http://dot-bit.org/tools/nextDifficulty.php<h2>Namecoin difficulty</h2> <table cellpadding="0" cellspacing="0" class="liste"> <tr> <th></th> <th>Block</th> <th>Time</th> <th>Difficulty</th> <th>Ratio</th> </tr> <tr> <td style="text-align: left;"><abbr title="Last difficulty change">Last change</abbr></td> <td>38304</td> <td>16/01/2012 07:06</td> <td><abbr title="3'523.80GH/s">516'181.44</abbr></td> <td><abbr title="Based on elapsed blocks since last difficulty change">x1.04</abbr></td> </tr>
I was gonna do that, but there has to be an easier method. I'll wait on the "bitcoind getdifficulty" thingy here you go... a bullet-proof php attempt: <?php $moo = file_get_contents('http://dot-bit.org/tools/nextDifficulty.php'); $moo = substr($moo, strpos($moo, 'H/s') + 5); $moo = substr($moo, 0, strpos($moo, '<')); $diff = str_replace('\'','',$moo); ?>
|
|
|
|
scintill
|
|
January 17, 2012, 04:26:03 AM |
|
Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
ummm. what? Lol If you run bitcoind, namecoind, devcoind and keep them synced with the network, it's as easy as $ bitcoind getdifficulty 1250757.73927466
at the shell, or via HTTP RPC requests if you set that up. I'm not so sure if the person I'm helping have that installed, how can I tell and how can I call it via php. Sorry if I'm asking too much. You can check by trying "bitcoind getdifficulty" at the command line and seeing if it works. If it does, the PHP is simple: <?php $difficulty = (float)`bitcoind getdifficulty`; echo "Difficulty is ", $difficulty, "\n";
The "`" symbols are the "backtick operator", but shell_exec() is equivalent. Replacing bitcoind with namecoind, etc., would make it work for all chains, if all the servers are installed and running. From the sounds of it installing and maintaining nodes for each chain is more complicated than you want. The APIs at http://blockexplorer.sytes.net/q might meet your needs, but last I looked some of the chains were out of date, and it seems to be down right now. I also couldn't figure out how to use the relevant API call -- it would be something like http://blockexplorer.sytes.net/chain/Bitcoin/q/nethash , but I couldn't figure out how to narrow it to just the current difficulty.
|
1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
|
|
|
payb.tc
|
|
January 17, 2012, 04:31:23 AM |
|
You can check by trying "bitcoind getdifficulty" at the command line and seeing if it works. If it does, the PHP is simple: <?php $difficulty = (float)`bitcoind getdifficulty`; echo "Difficulty is ", $difficulty, "\n";
The "`" symbols are the "backtick operator", but shell_exec() is equivalent. Replacing bitcoind with namecoind, etc., would make it work for all chains, if all the servers are installed and running. wouldn't that approach also require you to know the full path to bitcoind?
|
|
|
|
scintill
|
|
January 17, 2012, 04:37:36 AM |
|
here you go... a bullet-proof php attempt: <?php $moo = file_get_contents('http://dot-bit.org/tools/nextDifficulty.php'); $moo = substr($moo, strpos($moo, 'H/s') + 5); $moo = substr($moo, 0, strpos($moo, '<')); $diff = str_replace('\'','',$moo); ?>
simon66, this is probably your best bet, in combination with similar pages for the other chains you're interested in. wouldn't that approach also require you to know the full path to bitcoind?
If it is not in the PATH environment variable, you would have to put the full path. Mine is in the PATH, so it works.
|
1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
|
|
|
simon66 (OP)
|
|
January 17, 2012, 05:09:10 AM |
|
looking here he got bitcoind, namecoind, and devcoind. It's installed on /var/www/files/daemons/ I tried $difficulty = (float)shell_exec('/var/www/files/daemons/bitcoind getdifficulty'); echo "Difficulty is ", $difficulty, "\n"; and I got "Difficulty 0"
|
|
|
|
payb.tc
|
|
January 17, 2012, 05:12:48 AM |
|
looking here he got bitcoind, namecoind, and devcoind. It's installed on /var/www/files/daemons/ I tried $difficulty = (float)shell_exec('/var/www/files/daemons/bitcoind getdifficulty'); echo "Difficulty is ", $difficulty, "\n"; and I got "Difficulty 0" do you know if bitcoind was actually already up and running or did your command launch it? > ps aux|grep bit
|
|
|
|
scintill
|
|
January 17, 2012, 05:31:26 AM |
|
looking here he got bitcoind, namecoind, and devcoind. It's installed on /var/www/files/daemons/ I tried $difficulty = (float)shell_exec('/var/www/files/daemons/bitcoind getdifficulty'); echo "Difficulty is ", $difficulty, "\n"; and I got "Difficulty 0" do you know if bitcoind was actually already up and running or did your command launch it? > ps aux|grep bit Yeah, check that, and if the chain is synced up. There is a "getblockcount" command that should be close to http://blockexplorer.com/q/getblockcount . (If the server isn't started "bitcoind -daemon" is how I start it, maybe there are better ways.)
|
1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
|
|
|
|