Skip to main content

A lightweight EVM blockchain indexer and explorer

Project description

LocalScan

A lightweight EVM blockchain indexer and explorer. LocalScan connects to any EVM-compatible node via WebSocket, 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 and transaction indexing via WebSocket (eth_subscribe)
  • 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 WebSocket and HTTP RPC endpoints (e.g. Anvil, Hardhat, Geth, Reth)

Installation

From PyPI (pip)

pip install localscan

From Source

git clone https://github.com/your-org/localscan.git
cd localscan
git submodule update --init --recursive
pip install .

Development Install

git clone https://github.com/your-org/localscan.git
cd localscan
git submodule update --init --recursive
pip install -e .

Usage

Start the Explorer

localscan

This starts the indexer and web server on http://127.0.0.1:8000 by default, connecting to a local node at ws://127.0.0.1:8545.

Options

localscan [OPTIONS]

  --host          Bind host (default: 127.0.0.1)
  --port          Bind port (default: 8000)
  --rpc-url       WebSocket RPC URL (default: ws://127.0.0.1:8545)
  --http-rpc-url  HTTP RPC URL for receipts and calls (default: http://127.0.0.1:8545)
  --db            Path to the SQLite database file (default: chain_indexer.db)
  --keep-db       Keep the existing database on startup instead of wiping it
  --reload        Enable auto-reload for development

Example — Connect to a Custom Node

localscan \
  --rpc-url ws://my-node:8546 \
  --http-rpc-url http://my-node:8545 \
  --port 3000 \
  --keep-db

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, chain-sniper integration
    db/           # SQLAlchemy models and session
    routes/       # FastAPI route handlers
    templates/    # Jinja2 HTML templates
    static/       # CSS and JS assets
    cli.py        # Entry point
    main.py       # FastAPI application
  chain-sniper/   # WebSocket block subscription submodule
  alembic/        # Database migrations

Database Migrations

LocalScan uses Alembic for schema migrations.

alembic upgrade head

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localscan-0.1.0.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localscan-0.1.0-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file localscan-0.1.0.tar.gz.

File metadata

  • Download URL: localscan-0.1.0.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for localscan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a43a1b81ea6f49cb1a285a213fae4e0d652f56460bde051c07482d7a01b1489
MD5 40e4af91a0415ca464ef38492393e785
BLAKE2b-256 219ff0730d80aa85ba5b71f057d6430ed78fe5f7c0206eea6b3a02443a8f241e

See more details on using hashes here.

File details

Details for the file localscan-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: localscan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for localscan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9afdbe730c2f95c0ad129d2aaeab60c871041f30577990fbf849cfc1ee9b0f7a
MD5 f8c60c1b271ac884d108f05b8e46c113
BLAKE2b-256 5a76bbb81387011da98da5742310510f74503ab78fc2609672eba1ee17b453a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page