Skip to main content

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 async — SyncBlockpartyClient 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 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/defidebauchery/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

Metadata

Release files for blockparty 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blockparty 0.8.0
File Size Uploaded
blockparty-0.8.0.tar.gz 203.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blockparty 0.8.0
File Interpreter ABI Platform
blockparty-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 282.3 kB

Release files / blockparty-0.8.0.tar.gz

Download URL blockparty-0.8.0.tar.gz
Size 203.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c776571bb1af07bae9c8e881fb60cf3b67645bee07245927591a0bf837d3e310
BLAKE2b-256 checksum
How to use checksums
a0ffed5ac834426723b36f919dc2f355941a8635bfe50b06b372eaff0a2167c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / blockparty-0.8.0-py3-none-any.whl

Download URL blockparty-0.8.0-py3-none-any.whl
Size 79.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf4db4fede776cdd2b5378cb22dcca43196d9d707582d9a6b453fd4d477c013d
BLAKE2b-256 checksum
How to use checksums
76709b40dea63c6d85512c05025b23db2fa26bd955ca7cd409ec635728d36baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.5

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page