Skip to main content

LocalScan

A lightweight EVM blockchain indexer and explorer. LocalScan connects to any EVM-compatible node via WebSocket or HTTP, indexes blocks and transactions in real time into a local SQLite database, and exposes a web UI alongside a REST API for querying chain data.

Features

  • Real-time block indexing via WebSocket (eth_subscribe) or HTTP polling — use whatever your node supports
  • ERC-20 transfer log tracking and token balance caching
  • Address, contract, and token metadata resolution
  • Web-based block explorer UI
  • REST API for blocks, transactions, and addresses
  • SQLite storage — no external database required
  • Automatic reconnect and reorg detection

Requirements

  • Python 3.10 or higher
  • An EVM-compatible node with an RPC endpoint (e.g. Anvil, Hardhat, Geth, Reth, Infura, Alchemy)

Installation

pip install localscan

From Source

git clone https://github.com/rakibhossain72/localscan.git
cd localscan
pip install -e .

Usage

localscan --rpc-url <RPC_URL>

LocalScan auto-detects the protocol from the URL:

  • ws:// or wss:// → WebSocket mode using eth_subscribe (real-time, recommended)
  • http:// or https:// → HTTP polling mode (polls for new blocks every 2 seconds)

Examples

# Local Anvil / Hardhat node — WebSocket
localscan --rpc-url ws://localhost:8545

# Local node — HTTP polling
localscan --rpc-url http://localhost:8545

# Remote node — WebSocket
localscan --rpc-url wss://mainnet.infura.io/ws/v3/YOUR_KEY

# Remote node — HTTPS polling
localscan --rpc-url https://mainnet.infura.io/v3/YOUR_KEY

# Custom port, persistent database
localscan --rpc-url ws://localhost:8545 --port 3000 --keep-db

All Options

  --rpc-url    RPC endpoint — ws/wss for WebSocket, http/https for polling
               (default: ws://127.0.0.1:8545)
  --host       Bind host (default: 127.0.0.1)
  --port       Bind port (default: 8000)
  --db         Path to SQLite database file (default: chain_indexer.db)
  --keep-db    Keep existing database on startup instead of wiping it
  --reload     Enable auto-reload for development

REST API

Method Endpoint Description
GET /blocks/{block_number} Get block by number
GET /transactions/{tx_hash} Get transaction by hash
GET /addresses/{address} Get address, contract, and token info

All endpoints return JSON. The web UI is served at /.

Project Structure

localscan/
  app/
    indexer/    # Block ingestion, WebSocket and HTTP polling modes
    db/         # SQLAlchemy models and session
    routes/     # FastAPI route handlers
    templates/  # Jinja2 HTML templates
    static/     # CSS assets
    cli.py      # Entry point
    main.py     # FastAPI application
  alembic/      # Database migrations

License

MIT — see LICENSE.

Metadata

Release files for localscan 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for localscan 0.1.4
File Size Uploaded
localscan-0.1.4.tar.gz 37.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for localscan 0.1.4
File Interpreter ABI Platform
localscan-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 88.5 kB

Release files / localscan-0.1.4.tar.gz

Download URL localscan-0.1.4.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3e184860a82a88e772818f6fc3f9eeb48724f6dd58212d9d8e7f059fbb509648
BLAKE2b-256 checksum
How to use checksums
2ac688c17b279e42d5bee46389a41a14cf787ca7944fed9d10788b2f1d9fdf26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / localscan-0.1.4-py3-none-any.whl

Download URL localscan-0.1.4-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3108dd8cbc08f23c4a8978c05708c108ca72b731f08512781f01e325d7ce079
BLAKE2b-256 checksum
How to use checksums
b9e93f547018e71f19f28e73741a30c28a89b9d1c6b61d3020bf25b877be3fc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page