Python client for Envio's HyperSync. Built on top of the Rust implementation via PyO3 bindings, providing high-performance blockchain data access with a Pythonic interface.
HyperSync is Envio's high-performance blockchain data retrieval layer. It is a purpose-built alternative to JSON-RPC endpoints, offering up to 2000x faster data access across 70+ EVM-compatible networks and Fuel.
HyperSync lets you query logs, transactions, blocks, and traces with flexible filtering and field selection, returning only the data you need.
If you need a full indexing framework on top of HyperSync with GraphQL APIs and schema management, see HyperIndex.
- High performance: Built on a Rust core via PyO3 bindings for maximum efficiency
- Pythonic interface: Full type hints and async/await support
- Parquet export: Stream results directly to Parquet files via
collect_parquetfor large dataset workflows - Flexible queries: Filter logs, transactions, blocks, and traces
- Field selection: Retrieve only the fields you need
- Preset queries: Built-in helpers for common query patterns
- Streaming: Process large datasets without loading everything into memory
- 70+ networks: Access any HyperSync-supported network
pip install hypersyncRequires Python 3.9 or newer.
An API token is required to use HyperSync. Get your token here, then set it as an environment variable:
export ENVIO_API_TOKEN="your-token-here"Fetch all Transfer event logs from a USDT contract on Ethereum:
import os
import asyncio
import hypersync
async def main():
client = hypersync.HypersyncClient(hypersync.ClientConfig(
url="https://eth.hypersync.xyz",
bearer_token=os.environ["ENVIO_API_TOKEN"]
))
usdt_contract = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
# ERC-20 Transfer event topic0
transfer_topic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
query = hypersync.preset_query_logs_of_event(
usdt_contract,
transfer_topic,
from_block=17_000_000,
to_block=17_000_100
)
res = await client.get(query)
print(f"Found {len(res.data.logs)} Transfer events")
asyncio.run(main())See the examples directory for more patterns including block data, wallet transactions, Uniswap swap events, Parquet export, and streaming with a progress bar.
Change the url to connect to any supported network:
# Arbitrum
client = hypersync.HypersyncClient(hypersync.ClientConfig(
url="https://arbitrum.hypersync.xyz",
bearer_token=os.environ["ENVIO_API_TOKEN"]
))
# Base
client = hypersync.HypersyncClient(hypersync.ClientConfig(
url="https://base.hypersync.xyz",
bearer_token=os.environ["ENVIO_API_TOKEN"]
))See the full list of supported networks and URLs.
# Recommended: use a virtual environment
python -m venv .venv
source .venv/bin/activate
# Install with example dependencies
pip install -e ".[examples]"
# Set your API token
export ENVIO_API_TOKEN="your-token-here"
# Run an example
python examples/simple_logs_of_event.pyThe Python client is a natural fit for data science workflows, analytics pipelines, and any application that needs fast access to blockchain data from Python:
- Blockchain data analytics: Scan entire chain histories in seconds and analyse results with pandas or numpy
- ETL pipelines: Extract on-chain data and export to Parquet for downstream processing
- Research and dashboards: Pull historical event data at scale for protocol research or monitoring
- Block explorers: Power responsive interfaces with comprehensive real-time data access
- Monitoring tools: Track wallet activity, token transfers, and contract events in near real-time
- Cross-chain applications: Query unified data across 70+ EVM chains from a single client
- HyperSync Documentation
- Query Reference
- All Client Libraries (Node.js, Rust, Go)
- PyPI Package
How does this compare to using JSON-RPC or web3.py? HyperSync retrieves data up to 2000x faster than traditional JSON-RPC. Scanning all ERC-20 transfers on Ethereum mainnet takes seconds rather than hours.
Do I need an API token? Yes. Get one here.
Which networks are supported? 70+ EVM-compatible networks and Fuel. See the full list.
Can I export data to Parquet?
Yes. Parquet is the recommended format for large datasets. Use collect_parquet to stream results directly to a Parquet file. See examples/parquet_blocks_and_transactions.py for an example.
Is this suitable for data science workflows? Yes. The Python client is a good fit for data analytics, research, and workflows that integrate with pandas, numpy, or other Python data tools. The docs explicitly recommend it for data science use cases.
How is this different from the Rust client? This client is built on top of the Rust client via PyO3 bindings. It provides a Pythonic interface with full type hints. If you need the lowest-level access with the least overhead, use the Rust client directly.
What is the difference between HyperSync and HyperIndex? HyperSync is the raw data access layer. Use it when you need direct access to blockchain data in your own pipeline. HyperIndex is the full indexing framework built on top of HyperSync, with schema management, event handlers, and a GraphQL API.