Build a simple multi-chain stats dashboard with Blockscout PRO API
This example uses REST methods with the PRO API. See the PRO API overview for information on creating and using an API key.
configgives you the supported chain IDschainscoutmakes them human-readable and lets you exclude testnetsstats-service /linestells you which chart names are validstats-service /lines/newTxnsgives you the daily tx data
Additional Blockscout stats enpdoints and documentation are available at https://blockscout.github.io/swaggers/services/stats/index.html
Endpoint Summary
The following REST calls can be used to get data for a stats app:| Load Data | API CALL | Purpose |
|---|---|---|
| 1. Get supported chains | GET https://api.blockscout.com/api/json/config | Get the list of chain IDs supported by PRO API (result.chains) |
| 2. Resolve chain metadata | GET https://chains.blockscout.com/api/chains?chain_ids=... | Resolve chain IDs into names, slugs, and mainnet/testnet metadata |
| 3. Discover available chart series | GET https://api.blockscout.com/{chainid}/stats-service/api/v1/lines | Discover which chart series are available for a given chain |
| 4. Fetch daily transactions | GET https://api.blockscout.com/{chainid}/stats-service/api/v1/lines/newTxns?from=YYYY-MM-DD&to=YYYY-MM-DD&resolution=DAY | Get daily transaction counts on one chain |
Flow
1. Get supported chains
result.chains as the source of supported PRO chain IDs.
2. Resolve chain metadata
- chain name
- short name / slug
- mainnet vs testnet
Example Result
3. Discover available charts
newTxns, but this endpoint is useful because it also shows what else you can chart later without guessing.
Typical follow-up uses:
- daily users
- gas usage
- blocks
- fees
- other precomputed time-series exposed by the stats service
4. Fetch daily transactions
TypeScript example
This script:- fetches supported chain IDs
- resolves chain metadata
- keeps mainnets only
- fetches
newTxnsfor the last 30 days - prints a daily tx table for each chain
Result
- compare activity across mainnets
- dump results into CSV later
- feed a BI tool
- build a lightweight internal dashboard