Hedera Stats provides quantitative statistical measurements for the Hedera network, leveraging open-source methodologies, Hedera mirror node data, third-party data sources, and Hgraph's GraphQL API. These statistics include network performance metrics, NFT analytics, account activities, and economic indicators, enabling transparent and consistent analysis of the Hedera ecosystem.
- Hedera Mirror Node or access to Hgraph's GraphQL API
- Prometheus (
promtool
) foravg_time_to_consensus
(view docs) - PostgreSQL database needed for SQL script execution (view docs)
- DeFiLlama API for decentralized finance metrics (view docs).
Clone this repository:
git clone https://github.com/hgraph-io/hedera-stats.git
cd hedera-stats
Install Prometheus CLI (promtool
):
curl -L -O https://github.com/prometheus/prometheus/releases/download/v3.1.0/prometheus-3.1.0.linux-amd64.tar.gz
tar -xvf prometheus-3.1.0.linux-amd64.tar.gz
# one way to add the tool to the PATH
cp prometheus-3.1.0.linux-amd64/promtool /usr/bin
Set up your database:
- Execute
src/up.sql
to create necessary database schema and tables. - Load initial data using SQL scripts from the
src/jobs
directory.
Configure environment variables (example .env
):
DATABASE_URL="postgresql://user:password@localhost:5432/hedera_stats"
HGRAPH_API_KEY="your_api_key"
Schedule incremental updates:
crontab -e
1 * * * * cd /path/to/hedera-stats/src/time-to-consensus && bash ./run.sh >> ./.raw/cron.log 2>&1
hedera-stats/
├── src/
│ ├── dashboard/ # SQL for Grafana dashboards & Grafana template
│ ├── helpers/ # Helper SQL functions
│ ├── jobs/ # Incremental data update scripts
│ ├── metrics/ # SQL queries for metrics
│ └── up.sql # Initial database schema setup
├── LICENSE
└── README.md
Metrics categories include:
- Accounts & Network Participants
- NFT-specific Metrics
- Network Performance & Economic Metrics
View all metrics & documentation →
Use Grafana to visualize metrics:
- Import
Hedera_KPI_Dashboard.json
fromsrc/dashboard
. - SQL queries provided in the same directory serve as data sources.
Query available metrics dynamically via GraphQL API (test in our developer playground):
query AvailableMetrics {
ecosystem_metric(distinct_on: name) {
name
description {
description
methodology
}
}
}
- Verify you're querying the correct API endpoint:
- Staging environment (
hgraph.dev
) may have incomplete data. - Production endpoint (
hgraph.io
) requires an API key.
- Staging environment (
- Use broader granularity (day/month) for extensive periods.
- Limit result size with
limit
andorder_by
. - Cache frequently accessed data.
- Full Hedera Stats Documentation →
- Hedera Mirror Node Docs
- Hedera Transaction Result Codes
- Hedera Transaction Types
- DeFiLlama API Documentation
- PostgreSQL Documentation
We welcome contributions!
- Fork this repository.
- Create your feature branch (
git checkout -b feature/new-metric
). - Commit changes (
git commit -am 'Add new metric'
). - Push to the branch (
git push origin feature/new-metric
). - Submit a Pull Request detailing your changes.