craigwatson / bitcoind-status Goto Github PK
View Code? Open in Web Editor NEWPHP application to display status and information from the Bitcoin node daemon.
Home Page: https://odin.vikingserv.net
License: Apache License 2.0
PHP application to display status and information from the Bitcoin node daemon.
Home Page: https://odin.vikingserv.net
License: Apache License 2.0
xxxxxxxx
Hi Craig,
I really like your application. I particularly like the simplicity of the display and the clarity of the information you've chosen to show.
I guess you've not done much with it since last year. I installed the application recently and came across a number of bugs which I fixed for my own setup, so thought you might like to know what I had to do.
To get the graphs to work I had to change template.html from this:
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<script type="text/javascript">
to this:
<script src="https://www.gstatic.com/charts/loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<script>
google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);
To get the latency to display correctly I had to alter functions.php from this:
// Get node info from bitnodes.earn.com
if ($config['display_bitnodes_info'] === true) {
$data['bitnodes_info'] = json_decode(curlRequest("https://bitnodes.earn.com/api/v1/nodes/" . $data['node_ip'] . "-8333/", $bitnodes_curl), true);
$latency = json_decode(curlRequest("https://bitnodes.earn.com/api/v1/nodes/" . $data['node_ip'] . "-8333/latency/", $bitnodes_curl), true);
$data['bitnodes_info']['latest_latency'] = $latency['daily_latency'][0]['v'];
}
To this:
// Get node info from bitnodes.io
if ($config['display_bitnodes_info'] === true) {
$data['bitnodes_info'] = json_decode(curlRequest("https://bitnodes.io/api/v1/nodes/" . $data['node_ip'] . "-8333/", $bitnodes_curl), true);
$latency = json_decode(curlRequest("https://bitnodes.io/api/v1/nodes/" . $data['node_ip'] . "-8333/latency/", $bitnodes_curl), true);
$data['bitnodes_info']['latest_latency'] = $latency['daily_latency'][0]['v'];
}
To get the node height percentage to show correctly I had to remove this from functions.php:
// Get max height from bitnodes.earn.com
if ($config['display_max_height'] === true) {
if ($config['display_testnet'] === true) {
$exec_result = json_decode(curlRequest("https://chain.so/api/v2/get_info/BTCTEST", $bitnodes_curl), true);
} else {
$exec_result = json_decode(curlRequest("https://chain.so/api/v2/get_info/BTC", $bitnodes_curl), true);
}
$data['max_height'] = $exec_result['data']['blocks'];
$data['node_height_percent'] = round(($data['blocks']/$data['max_height'])*100, 1);
}
and replace it with this:
$data['node_height_percent'] = round(($data['verificationprogress'])*100, 1);
Hope this helps!
Cheers
Mark
Just a heads up for the future. Possible reworking needed.
WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16
Can you give me some more information on how to install this (running ubuntu)?
i changed datadir in bitcoind.conf and now it wont output nothing? is there a ways to fix it?
Hi unsure whats causing this but since pulling the new version's for use on 0.16 performance has been really bad taking 60+ seconds to render the page and mostly timing out. Going back to a previous version and changing getinfo to getnetworkinfo seems to fix this so it must be something else.
I've attached my working version as i am unsure at what point in the commit history it was?
Ubuntu 16.04
Nginx
PHP 7.0
Bitcoin Core 16.0
node.arihanc.com (to view the live version)
Any help appreciated thanks.
Hi Craig, some reason the node-status page I'm running for my altcoin has stopped working. I believe it may have occured after the recent php update to version 5.5.9 including curl as well.
currently when i run > curl -Ssk http://cryptostakers.com/node/stats.php > i get the error >๏ปฟ
173.245.xxx.xxx is not in the whitelist (however this ip changes due to the server being behind cloudflare)
so i'm not sure if the php script is trying to do rpc call from outside the server? it shouldn't be doing this however, since it wasn't doing so before.
and if i add the ip to the whitelist, and run the same curl, i get "rpc error".
If you could assist with this, please and thank you.
E.g. free disk space and uptime are not displayed correctly if web server resides on a different machine than bitcoin daemon. Currently free disk space and uptime of the web server is shown rather then those of the remote machine where bitcoin daemon is running. The IP of that machine might also be affected, but ip info seems to be missing in the getnetworkinfo localaddresses array so this could be another problem (maybe of the daemon itself - running 0.14.2).
Anyway, it's a good status page to have a look at when you want to know what's going on with your bitcoin node. ๐
After installing the latest version:
If geolocate_peer_ip is set to false in config.php, every IP box displays the message "Notice: Undefined index: geo_data in /web/public_html/.../public/bitcoin/html/template.html on line 153".
Works OK if set to true.
I noticed in peercount.php
// Include EasyBitcoin library and set up connection
require_once '/srv/www/bitcoind-status/php/easybitcoin.php';
$bitcoin = new Bitcoin($config['rpc_user'], $config['rpc_pass'], $config['rpc_host'], $config['rpc_port']);
The path to "easybitcoin.php" is hardcoded.
Also do you need to run "peercount.php"via a cron?
Thanks
Hi Craig,
Sorry forgot to ask you how to setup the 'Node Links" in the config.php
I just want to put the DigiCube Logo and link it to Bitcointalk Thread
I was reviewing the array structure to hide certain peers from the peer list table and noticed that hiding IPv6 peers didn't work, but IPv4 peers did. I was using this format to hide them.
'peers_to_ignore' => array(
'x.x.x.x', // Example peer to hide
'x.x.x.x' // Example peer to hide
),
Looking at the array output, it looks like IPv6 peers are not stored properly. I dumped the array of a live node that has both v4 and v6 peers connected and this is the output. Notice how all IPv6 addresses are cut off after each semi-colon. Currently I don't think IPv6 peers can be hidden from the list, with this issue.
Array
(
[0] => [2a00
[1] => 1398
[2] => 4
[3] => 2a00
[4] =>
[5] => a1]
[6] => 50434
)
Array
(
[0] => [2a01
[1] => 4f8
[2] => 121
[3] => 14f7
[4] =>
[5] => 2]
[6] => 11764
)
Array
(
[0] => 136.243.139.120
[1] => 11034
)
Array
(
[0] => [2a01
[1] => 4f8
[2] => 212
[3] => 3b1f
[4] =>
[5] => 2]
[6] => 58582
)
Array
(
[0] => 91.121.108.36
[1] => 8333
)
Array
(
[0] => 77.249.29.104
[1] => 8333
)
Array
(
[0] => 47.54.207.91
[1] => 8333
)
Array
(
[0] => 148.251.191.101
[1] => 8333
)
Array
(
[0] => 129.13.252.47
[1] => 60740
)
Array
(
[0] => [2a00
[1] => 1398
[2] => 4
[3] => 2a00
[4] =>
[5] => a5]
[6] => 56708
)
Array
(
[0] => 129.13.252.36
[1] => 53883
)
Array
(
[0] => [2400
[1] => 4123
[2] => a344
[3] => 1600
[4] => 8da0
[5] => 82cf
[6] => 3244
[7] => 3884]
[8] => 60869
)
Array
(
[0] => 203.59.32.206
[1] => 54275
)
Array
(
[0] => 77.178.239.123
[1] => 32798
)
Array
(
[0] => 192.168.1.10
[1] => 47542
)
Array
(
[0] => [2001
[1] => 0
[2] => 9d38
[3] => 6abd
[4] => 24fe
[5] => 3c9b
[6] => a244
[7] => 416f]
[8] => 55922
)
Array
(
[0] => 91.99.99.204
[1] => 8333
)
Array
(
[0] => 70.33.168.27
[1] => 43959
)
Array
(
[0] => 89.164.214.136
[1] => 51046
)
Array
(
[0] => 188.239.121.120
[1] => 53946
)
Array
(
[0] => 75.169.152.193
[1] => 52276
)
Array
(
[0] => 202.153.71.3
[1] => 8333
)
Array
(
[0] => 2.227.190.195
[1] => 49467
)
Array
(
[0] => 173.27.90.112
[1] => 37294
)
Array
(
[0] => [2a02
[1] => 678
[2] => 528
[3] => c200
[4] => 5c38
[5] => 7464
[6] => 2b3a
[7] => 1759]
[8] => 50593
)
Array
(
[0] => 71.194.203.200
[1] => 59749
)
Array
(
[0] => 72.36.89.11
[1] => 37888
)
Array
(
[0] => 202.108.211.56
[1] => 33689
)
Array
(
[0] => 84.142.215.179
[1] => 60978
)
Array
(
[0] => 70.33.168.27
[1] => 15814
)
Array
(
[0] => [2002
[1] => 2f5f
[2] => 9078
[3] =>
[4] => 2f5f
[5] => 9078]
[6] => 8333
)
Array
(
[0] => 144.76.129.186
[1] => 8333
)
Array
(
[0] => 70.33.168.27
[1] => 10112
)
Array
(
[0] => 212.35.25.161
[1] => 58100
)
I'm thinking its likely due to:
https://github.com/craigwatson/bitcoind-status/blob/master/php/functions.php#L193
You are using a colon as essentially the delimiter for the ip:port like 194.168.55.46:8333, but this doesn't take into account the format of an IPv6 peer and breaks the output.
After upgrading to bitcoin 13.0, in the ping column where previously the ping showed '0', it gives an error:
Notice: Undefined index: pingtime in /web/public_html/jazzpie.com/public/bitcoin/html/template.html on line 183
0
The ping displays normal if the ping result is anything other than '0'.
I have never seen this error before, and now have it on both of my servers after the upgrade to bitcoin 13.0.
The free disk space monitor only shows the root free space. With the blockchain becomming bigger I use a second disk to store it and create a symlink for .bitcoin folder to that disk.
A option in the config to specify witch disk to monitor would be a welcome solution.
It's declaring
There has been an error communicating with the Bitcoin Daemon
HTTP_UNAUTHORIZED
Please let me know the solution to this thanks
If you put a segwit adres in the donation variable the generated qr code is not a valled adress.
To reproduce:
Enter a segwit address as donation address and scan the code with a qr scanner. (i used bread on ios)
Hello.
I'm just trying to get going with bitcoind-status and am getting the following error on index.php "method not found" when running against the latest version of bitcoin core from the git master branch. 0.15.99.
When run against a bitcoin abc node bitcoind status produces the expected results.
Is there anyway I can debug what method is missing in the latest core release?
Not sure what you think but for users who host bitcoind-status on Apache. It might be beneficial to include a .htaccess
with some default rules. Particularly, for protecting the stats.php
and peercount.php
pages. I know a whitelisting system is in place, but every request still have to be checked by the app. Blocking at the server level might be more beneficial from a security point of view. With Apache it would be easily achieved with something like the examples below.
# Apache 2.4
<FilesMatch "^(stats\.php|peercount\.php)$">
Require local
</FilesMatch>
# Apache 2.2
<FilesMatch "^(stats\.php|peercount\.php)$">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</FilesMatch>
Instant 403 to any client that tries to access those pages outside of localhost, never touches the PHP app.
I personally deploy this code within the VirtualHost config, but it would work fine in .htaccess
Just my thoughts.
i am not able to get difficulty and charts displayed for altcoin any help would be appreciated. thanks
Hi Craig,
I have your bitcoind-status application working on my old laptop server. Everything appears to be working well, except the Google graphs.
When the data reaches the minimum data point level, a space occurs where the graphs should be. That's directly under the number of connections line. Before that happens there is no extra space there. There are currently 13 live connections to my node.
The laptop is running:
Debian 10
Apache 2.4.38
PHP 7.3
Satoshi 0.20.0 (still synching)
I'm not expecting the sync on this node to ever compete, as the drive is far too small. This just a test to make sure I know what I'm doing. It can be wiped and reloaded with a different configuration if required. I aim to build a final node later when I am happy with everything on this one.
The php CRON jobs are running every 5 minutes and the data files are filling up:
/tmp/bitcoind-peers.data
/tmp/bitcoind-status.data
All these pages display various forms of text data:
http://192.168.1.111/chartdata.php?stat=connection
http://192.168.1.111/chartdata.php?stat=peer
http://192.168.1.111/stats.php?view
http://192.168.1.111/peercount.php?view
When I look at the developers console in Chrome I see this:
Uncaught Error: Autoload failed with: SyntaxError: Unexpected token ' in JSON at position 1
at zc (loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:84)
at xc (loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:83)
at loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:96
at loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:96
loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:89
Uncaught Error: Must call google.charts.load before google.charts.setOnLoadCallback
at Object.E.N [as setOnLoadCallback] (loader.js?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}:89)
at (index):36
For fault finding I have given all the files in the bitcoind-status web directory 777 access and made sure they are all owned by www-data.
I have also set the majority of the options in the configuration file to true.
I'm just a bit stuck now with working out how to get a graphs to appear. Do you have any ideas?
Cheers
Mark
Would it be possible to have the display update dynamically? i.e. not have to refresh the page? Perhaps it could then update every second, if desired. (perhaps too much data for a WAN though).
Since the update to support 0.16 node height and difficulty are displayed as 0.
Hi,
How can I make the page show all connected peers even if it is thousands? This is what I was hoping for but don't see a way to change it.
Any help would be greatly appreciated
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.