Skip to main content

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.

Installation

pip install blockparty

For httpx support:

pip install "blockparty[httpx]"

Requires Python ≥ 3.10.

Features

  • Multi-provider support — Etherscan, Routescan, and Blockscout behind one API
  • Normalized responses — Consistent Pydantic models regardless of which explorer answered
  • Sync and asyncSyncBlockpartyClient and AsyncBlockpartyClient
  • 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 via ProviderSet
  • Pluggable HTTP backend — aiohttp + requests (default) or httpx (optional)
  • Transport injection — Pass your own aiohttp.ClientSession or httpx.AsyncClient
  • Response caching — Configurable TTL, per-request force_refresh override
  • 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

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 providersProviderSet shares rate limit budgets across clients, supports per-chain API keys via chain_ids, and gives every client automatic fallback with FallbackWarning.

Connection poolAsyncBlockpartyPool / 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


Download files

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

Source Distribution

blockparty-0.7.0.tar.gz (202.6 kB view details)

Uploaded Source

Built Distribution

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

blockparty-0.7.0-py3-none-any.whl (79.7 kB view details)

Uploaded Python 3

File details

Details for the file blockparty-0.7.0.tar.gz.

File metadata

  • Download URL: blockparty-0.7.0.tar.gz
  • Upload date:
  • Size: 202.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blockparty-0.7.0.tar.gz
Algorithm Hash digest
SHA256 c3f79d1af2f906b8209540a57ac4a06b84a876396b6165f5e4c263185b3169d5
MD5 f76988de4d32c312b3a861e6d80cc503
BLAKE2b-256 6835d3462c1b6d458fe98ddc8e8d4dc72036109162d53d969640b1e4e02a502c

See more details on using hashes here.

Provenance

The following attestation bundles were made for blockparty-0.7.0.tar.gz:

Publisher: publish.yml on DefiDebauchery/blockparty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blockparty-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: blockparty-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 79.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blockparty-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76b21d4a08e1e99af0d3758b8662e490e192d54f9c1f6ae6c55d82b7c7d42968
MD5 b3244eb63ce6c4f0a8ca91e5be7c4e3f
BLAKE2b-256 ad2fb049d09a85dd9813cf8352060bd5fb04fe0ee4609e3c4788c776ff36e3ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for blockparty-0.7.0-py3-none-any.whl:

Publisher: publish.yml on DefiDebauchery/blockparty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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