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://orwss://→ WebSocket mode usingeth_subscribe(real-time, recommended)http://orhttps://→ 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| localscan-0.1.4.tar.gz | 37.9 kB | Without provenance | Details for localscan-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| localscan-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for localscan-0.1.4-py3-none-any.whl |
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
|
Security for localscan 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.