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.3.tar.gz (37.8 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.3-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: localscan-0.1.3.tar.gz
  • Upload date:
  • Size: 37.8 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.3.tar.gz
Algorithm Hash digest
SHA256 253a5909efb70055c5132c81fe4b7cce434f42ff00f77592c40fb2d756490703
MD5 be4a8b38afc2245158b0e407bc79d0f4
BLAKE2b-256 0d07af30c04663ea49a2fe1ecf09bc33a6660d3df7567c52ad4d88204b0f3f0a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: localscan-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 49.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87f2450143237709ecafd6c7139c3337033eb2651b088c843e43fb4b6855c413
MD5 a907a00d209dff184085fb603f1e3b11
BLAKE2b-256 59493d18fe00efcc0968262f084ec0a6e2eba577f86b313331287782e47da822

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