Unified Python client for Etherscan, Routescan and Blockscout EVM block explorer APIs
Project description
blockparty
A unified Python client for EVM block explorer APIs — Etherscan, Routescan, and Blockscout.
Normalizes responses across providers, supports both sync and async usage, provides automatic fallback across providers, and builds frontend explorer URLs.
Features
- Multi-provider support — Etherscan, Routescan, and Blockscout behind one API
- Normalized responses — Consistent Pydantic models regardless of which explorer answered
- Sync and async —
SyncBlockpartyClientandAsyncBlockpartyClient - Provider fallback — Clients try providers in order, automatically falling back on transient errors
- Shared rate limiting — Per-
(provider, api_key)token bucket shared across all clients viaProviderSet - Pluggable HTTP backend — aiohttp + requests (default) or httpx (optional)
- Transport injection — Pass your own
aiohttp.ClientSessionorhttpx.AsyncClient - Response caching — Configurable TTL, per-request
force_refreshoverride - Retry with backoff — Exponential backoff + jitter on transient errors
- Frontend URL builder — Generate explorer links for addresses, transactions, tokens, and blocks
- Bundled chain registry — 600+ chains with offline lookup and CLI regeneration
Installation
pip install blockparty
For httpx support:
pip install "blockparty[httpx]"
Requires Python ≥ 3.10.
Quick Start
Async
from blockparty import AsyncBlockpartyClient
async with AsyncBlockpartyClient(chain_id=8453) as client:
response = await client.get_internal_transactions(
address="0x4200000000000000000000000000000000000006",
start_block=7775467,
limit=10,
sort="asc",
)
for tx in response.result:
print(f"{tx.hash}: {tx.value} wei")
Sync
from blockparty import SyncBlockpartyClient
with SyncBlockpartyClient(chain_id=8453) as client:
response = client.get_internal_transactions(address="0x...", limit=10)
No API key required — blockparty auto-resolves to the best available explorer (priority: Etherscan > Routescan > Blockscout).
What Else It Does
Client configuration — Explicit explorer types, API keys, tier selection, httpx backend, transport injection, cache tuning.
Shared providers —
ProviderSet shares rate limit budgets across clients, supports per-chain API
keys via chain_ids, and gives every client automatic fallback with
FallbackWarning.
Connection pool —
AsyncBlockpartyPool / SyncBlockpartyPool caches clients per chain and
delegates all fallback logic to ProviderSet.
URL builder —
.urls for the preferred explorer, .urls_for(resp.provider) for the
explorer that actually served a response. Supports Etherscan, Routescan
(vanity + generic), and Blockscout.
Chain registry — 600+ chains bundled, offline lookup by ID or name search, custom JSON files, CLI regeneration.
Rate limits & tiers —
Built-in tier enums for all three providers, CustomRateLimit for enterprise
plans, Blockscout adaptive headers.
Development
git clone https://github.com/your-org/blockparty.git
cd blockparty
pip install -e ".[dev]"
pytest
ruff check src/ tests/
See CONTRIBUTING.md for how to add new endpoints, run tests, and submit changes.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blockparty-0.6.0.tar.gz.
File metadata
- Download URL: blockparty-0.6.0.tar.gz
- Upload date:
- Size: 295.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a001636c68c76b285c5e471c2069872f3b423e6379540d8979f05fd0534ae0b
|
|
| MD5 |
2a6e2c74d0af2b27353c941eed61ce78
|
|
| BLAKE2b-256 |
d4442f1f71f086057c04f0f4e58500a5f8a219d5bfc7e7f27ddbe208c7cc2ea9
|
File details
Details for the file blockparty-0.6.0-py3-none-any.whl.
File metadata
- Download URL: blockparty-0.6.0-py3-none-any.whl
- Upload date:
- Size: 79.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88db5f594b82cf87d1cc87a65eb7dcde612ddd9d28d72f8f4e29b4cc7fcd71b5
|
|
| MD5 |
cddd2c09d59b5ad0d897c8fe4439b3a3
|
|
| BLAKE2b-256 |
85455cb53f75d5b0f0529ebe6ee238fb6506011d297649f5ec5ca98493efd051
|