A clean, single-page block explorer built with Next.js and Substrate API Sidecar. This serves as a template for building blockchain explorers for Polkadot SDK-based networks.
# Install dependencies
npm install
# Start your local Polkadot SDK node
# Make sure Sidecar is running on http://127.0.0.1:8080
# Run development server
npm run devOpen http://localhost:3000 to see the block explorer.
This explorer uses Next.js API Route Handlers to proxy requests to your local Sidecar instance, avoiding CORS issues
GET /api/blocks/head- Proxies tohttp://127.0.0.1:8080/blocks/head
All configuration is centralized in src/config.ts. To connect to a different Sidecar instance or network:
// src/config.ts
export const SIDECAR_BASE_URL = 'http://127.0.0.1:8080'; // Change this URL
export const NETWORK_NAME = 'Local Substrate Node'; // Change network name
export const NETWORK_SYMBOL = 'UNIT'; // Change token symbol- Polkadot SDK Node: Running locally or remotely (i.e., you can use a remote RPC endpoint for any Polkadot SDK-based network)
- Substrate API Sidecar: Connected to your node
# Install Sidecar globally
npm install -g @substrate/api-sidecar
# Run Sidecar (connects to ws://127.0.0.1:9944 by default)
substrate-api-sidecar
# Or connect to a specific node
SAS_SUBSTRATE_URL=wss://polkadot-asset-hub-rpc.polkadot.io substrate-api-sidecar- CORS Errors: Make sure you're accessing the app through the Next.js dev server, not opening the HTML file directly
- Sidecar Connection: Ensure Sidecar is running on the expected URL (check
src/config.ts) - Block Not Found: Some block numbers/hashes might not exist on your local chain
The code is intentionally simple to make it easy to extend:
- Add account lookup: Create
/api/accounts/[address]/route.ts - Add more endpoints: Follow the same pattern for other Sidecar endpoints
- Add network selector: Support multiple networks in one interface
Built with Tailwind CSS. Modify styles directly in the JSX or customize the theme in tailwind.config.ts.
MIT License - feel free to use this as a template for your own projects!