Skip to main content

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.
Blockscout’s extended chain coverage and curated stats endpoints allow you to create data dashboards covering multiple chains. In this brief example, we show the calls to get supported chain ids, select the chains you want to cover, and the stats to print. The flow is simple on purpose:
  • config gives you the supported chain IDs
  • chainscout makes them human-readable and lets you exclude testnets
  • stats-service /lines tells you which chart names are valid
  • stats-service /lines/newTxns gives you the daily tx data
Here we show the basic calls needed to retrieve stats info along with a typescript example at the end.
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:

Flow

1. Get supported chains

Use result.chains as the source of supported PRO chain IDs.

2. Resolve chain metadata

Use the response to turn raw chain IDs into something usable in a dashboard:
  • chain name
  • short name / slug
  • mainnet vs testnet

Example Result


3. Discover available charts

This tells you which stats charts exist for that chain (in this case chainid = 1, which is Ethereum mainnet) For a simple dashboard, you only need 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

This returns the daily tx time series for that chain. Run the same request for every mainnet chain you want to include.

TypeScript example

This script:
  • fetches supported chain IDs
  • resolves chain metadata
  • keeps mainnets only
  • fetches newTxns for the last 30 days
  • prints a daily tx table for each chain

Result

This can be used to:
  • compare activity across mainnets
  • dump results into CSV later
  • feed a BI tool
  • build a lightweight internal dashboard