A modern, fast, and secure PHP-based web interface for viewing ckpool statistics. It features a lightweight “Liquid Lava” design (using Inter & JetBrains Mono fonts), dynamic multi-series charts (up to 1 year), automatic light/dark theme switching, and is built for performance using SQLite and a local bitcoind node.
A live version of this stats viewer is running at:
This project is a statistics viewer for an existing, running instance of ckpool AND a local, running bitcoind node. It does not include the mining pool software itself.
bitcoind node accessible via bitcoin-cli by a dedicated user (e.g., bitcoinnode).php-sqlite3, php-curl.bitcoin-cli node for maximum reliability and speed.bitcoin-cli calculations with live network hashrate trends for a robust, weighted estimate.parser.php (5 min): Fetches all high-frequency data: user/pool stats, block height, block reward, and live BTC price. Stores in stats.db.prediction_parser.php (4x/day): Fetches all low-frequency data: network hashrate, difficulty, and calculates the H.A.N.T.I. prediction. Stores in network.db.parser.php, prediction_parser.php, common.php) and the data directory are secured from public web access via NGINX.Clone this repository into your desired web server directory.
git clone [https://github.com/hantiiii/light-ckpool-solo-stats-viewer.git](https://github.com/hantiiii/light-ckpool-solo-stats-viewer.git) /var/www/html/btcnode
(Adjust the path /var/www/html/btcnode if necessary)
Add a server block to your NGINX configuration to serve the application and secure the data directory and parser scripts.
server {
listen 443 ssl http2;
server_name your_domain.com;
root /var/www/html; # Adjust if your root is different
index index.php;
# SSL configuration...
# Block public access to all parsers and common files
location = /btcnode/parser.php { deny all; }
location = /btcnode/prediction_parser.php { deny all; }
location = /btcnode/common.php { deny all; }
# Block access to the data directory (databases)
location /btcnode/data/ {
deny all;
}
# Handle the application routing
location /btcnode/ {
try_files $uri $uri/ /btcnode/index.php?$args;
}
# Process PHP files
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# Adjust to your PHP-FPM socket path and version
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
}
After saving, test and restart NGINX:
sudo nginx -t && sudo systemctl restart nginx
Set the ownership and permissions for the project directory.
# Replace 'www-data' with your web server's group (e.g., 'client1')
# Replace /var/www/html/btcnode with your actual project path
WEB_GROUP=www-data
PROJECT_PATH=/var/www/html/btcnode
sudo chown -R root:${WEB_GROUP} ${PROJECT_PATH}
sudo find ${PROJECT_PATH} -type d -exec chmod 775 {} \;
sudo find ${PROJECT_PATH} -type f -exec chmod 644 {} \;
# Make parsers executable by root
sudo chmod +x ${PROJECT_PATH}/parser.php
sudo chmod +x ${PROJECT_PATH}/prediction_parser.php
Configuration is split into three files.
In common.php (Global Config):
// in /var/www/html/btcnode/common.php
$apiTimeout = 15;
// --- Bitcoin Core Config ---
$bitcoinCliUser = 'bitcoinnode'; // User running bitcoind
$bitcoinCliPath = '/usr/local/bin/bitcoin-cli'; // Path to bitcoin-cli
In parser.php (Cron 1 Config):
// in /var/www/html/btcnode/parser.php
$webUser = 'web1';
$webGroup = 'client1';
$usersDir = '/var/log/ckpool/users/';
$poolDir = '/var/log/ckpool/pool/';
In prediction_parser.php (Cron 2 Config):
// in /var/www/html/btcnode/prediction_parser.php
$webUser = 'web1';
$webGroup = 'client1';
$logFilePath = '/var/log/ckpool/ckpool.log'; // Fallback for difficulty
Two cron jobs are needed, running as root (which allows sudo -u bitcoinnode ... to work without password prompts).
sudo crontab -e
Add the following lines (example schedule: 3 min & 8x/day) and save the file:
# (3 min) Update user stats, pool stats, block height, block reward, and price
*/3 * * * * /usr/bin/php /var/www/html/btcnode/parser.php >/dev/null 2>&1
# (8x/day) Update network hashrate, difficulty, and prediction data
33 0,3,6,9,12,15,18,21 * * * /usr/bin/php /var/www/html/btcnode/prediction_parser.php >/dev/null 2>&1
Run both parsers manually once to initialize the databases and confirm bitcoin-cli communication.
sudo /usr/bin/php /var/www/html/btcnode/parser.php
sudo /usr/bin/php /var/www/html/btcnode/prediction_parser.php
Your stats page should now be live! The 1Y chart data will start populating after the first daily aggregation (runs automatically after midnight).
If you find this project useful and want to show your appreciation, donations are welcome!
BTC: 1HANfVCfy9CFp5JAjNBhKWPWbavjXxdCRR
This project is licensed under the MIT License.