Skip to content

Comments

Feat/explorer homepage metrics#520

Open
tanishqsh wants to merge 5 commits intomainfrom
feat/explorer-homepage-metrics
Open

Feat/explorer homepage metrics#520
tanishqsh wants to merge 5 commits intomainfrom
feat/explorer-homepage-metrics

Conversation

@tanishqsh
Copy link

Summary

image

Adds network metrics (24h transactions, total tokens, and 24h active accounts) to the explorer homepage.

Changes

New API endpoint /api/stats

  • Transaction count in last 24h (calculated by block number using 0.5s block time)
  • Total token count (capped at 100K)
  • Active accounts in last 24h (unique senders from sampled transactions)

NetworkStats component

  • Displays stats below spotlight links on homepage
  • Gracefully hidden during loading or on error (no layout shift)

Performance & Reliability

  • 60-second server-side cache to avoid IndexSupply rate limits
  • Thundering herd prevention — concurrent requests share a single fetch
  • Stale-while-error pattern — returns cached data if fresh fetch fails
  • Dynamic Cache-Control headers with accurate remaining TTL

Preview

Stats display as:

  • 15.4M txns / 24h
  • 100K+ tokens
  • +5.7K accounts / 24h

Checklist

  • pnpm check:types passes
  • pnpm check:biome passes
  • pnpm test passes

tanishqsh and others added 3 commits January 27, 2026 15:32
- Add /api/stats endpoint for network metrics
- Add NetworkStats component below spotlight pills
- Shows txns/24h, tokens count, accounts/24h
- Uses block_num filtering (24h ≈ 172,800 blocks at 0.5s/block)

Amp-Thread-ID: https://ampcode.com/threads/T-019c00e5-b80d-7485-872a-c46d5bb31aeb
Co-authored-by: Amp <amp@ampcode.com>
- Add /api/stats endpoint with 24h transactions, token count, and active accounts
- Add NetworkStats component with loading and error states
- Implement 60s server-side caching to avoid IndexSupply rate limits
- Add thundering herd prevention and stale-while-error resilience

Amp-Thread-ID: https://ampcode.com/threads/T-019c0131-d03f-7478-b89f-0afd1cf0725a
Co-authored-by: Amp <amp@ampcode.com>
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Bundle Size Report

Metric Size Δ Change
Total 4.6 MB +5.7 KB (+0.1%)
Gzip 1.2 MB +2.0 KB (+0.2%)
Brotli 1.1 MB +1.8 KB (+0.2%)
Chunk changes (>1KB)
Chunk Change
assets/_layout.js +2.3 KB
assets/router.js +3.0 KB

Compared against main branch (baseline from 1/27/2026, 3:31:27 AM)

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Cloudflare Deployments

App Environment Status Preview
explorer devnet [OK] Deployed View Preview
explorer moderato [OK] Deployed View Preview
explorer presto [OK] Deployed View Preview
explorer testnet [OK] Deployed View Preview
fee-payer devnet [>>] Skipped No changes
fee-payer privy [>>] Skipped No changes
fee-payer testnet [>>] Skipped No changes
og - [>>] Skipped No changes
tokenlist - [>>] Skipped No changes

@tanishqsh tanishqsh force-pushed the feat/explorer-homepage-metrics branch from 4098125 to 8d9425d Compare January 27, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants