HyperSync Complete Documentation
This document contains all HyperSync documentation consolidated into a single file for LLM consumption.
| What it is | A purpose-built, high-performance blockchain data retrieval layer built in Rust - a direct alternative to traditional JSON-RPC endpoints |
| Performance | Up to 2000x faster than traditional RPC (e.g. scan Arbitrum for sparse log data in 2 seconds vs. hours/days); ~500x faster for event queries |
| Supported networks | 70+ EVM chains and Fuel, with new networks added regularly |
| Client libraries | Python, Rust, Node.js, Go |
| API token | Required - set via ENVIO_API_TOKEN environment variable |
| Data types | Logs, transactions, traces, blocks - with fine-grained field selection |
| Query features | Log filters, transaction filters, trace filters, block filters, field selection, join modes, streaming |
| Quickstart | pnpx logtui aave arbitrum - zero setup required |
| Powers | HyperIndex, ChainDensity.xyz, Scope.sh, LogTUI, and more |
| Relationship to HyperIndex | HyperSync is the data engine; HyperIndex is the full indexing framework built on top of it |
| Support | Discord · GitHub |
HyperSync: Ultra-Fast & Flexible Data API
File: overview.md
What is HyperSync?
HyperSync is a purpose-built, high-performance data retrieval layer that gives developers unprecedented access to blockchain data. Built from the ground up in Rust, HyperSync serves as an alternative to traditional JSON-RPC endpoints, offering dramatically faster queries and more flexible data access patterns.
HyperSync is Envio's high-performance blockchain data engine that serves as a direct replacement for traditional RPC endpoints, delivering up to 2000x faster data access.
HyperIndex is built on top of HyperSync, providing a complete indexing framework with schema management, event handling, and GraphQL APIs.
Use HyperSync directly when you need raw blockchain data at maximum speed, or use HyperIndex when you need a full-featured indexing solution.
The Problem HyperSync Solves
Traditional blockchain data access through JSON-RPC faces several limitations:
- Speed constraints: Retrieving large amounts of historical data can take days
- Query flexibility: Complex data analysis requires many separate calls
- Cost inefficiency: Expensive for data-intensive applications
Key Benefits
- Exceptional Performance: Retrieve and process blockchain data up to 1000x faster than traditional RPC methods
- Comprehensive Coverage: Access data across EVM chains and Fuel, with new networks added regularly
- Flexible Query Capabilities: Filter, select, and process exactly the data you need with powerful query options
- Cost Efficiency: Dramatically reduce infrastructure costs for data-intensive applications
- Simple Integration: Client libraries available for Python, Rust, Node.js, and Go
Performance Benchmarks
HyperSync delivers transformative performance compared to traditional methods:
| Task | Traditional RPC | HyperSync | Improvement |
|---|---|---|---|
| Scan Arbitrum blockchain for sparse log data | Hours/Days | 2 seconds | ~2000x faster |
| Fetch all Uniswap v3 PoolCreated events ethereum | Hours | Seconds | ~500x faster |
Use Cases
HyperSync powers a wide range of blockchain applications, enabling developers to build tools that would be impractical with traditional data access methods:
General Applications
- Blockchain Indexers: Build high-performance data indexers with minimal infrastructure
- Data Analytics: Perform complex on-chain analysis in seconds instead of days
- Block Explorers: Create responsive explorers with comprehensive data access
- Monitoring Tools: Track blockchain activity with near real-time updates
- Cross-chain Applications: Access unified data across multiple networks
- ETL Pipelines: Create pipelines to extract and save data fast
Powered by HyperSync
HyperIndex
- 100x faster blockchain indexing across EVM chains and Fuel
- Powers 100 plus applications like v4.xyz analytics
ChainDensity.xyz
- Fast transaction/event density analysis for any address
- Generates insights in seconds that would take hours with traditional methods
Scope.sh
- Ultra-fast Account Abstraction (AA) focused block explorer
- Fast historical data retrieval with minimal latency
LogTUI
- Terminal-based UI for finding all historical blockchain events
- Built-in presets for 20+ protocols (Uniswap, Chainlink, Aave, ENS, etc.)
- Try it:
pnpx logtui aave arbitrumto track Aave events on Arbitrum in your terminal
See HyperSync in Action
Next Steps
- Try the Quick Start Guide to get up and running in minutes
- Build queries visually with our Intuitive Query Builder
- Get an API Token to access HyperSync services
- View Supported Networks to see available chains
- Check Client Documentation for language-specific guides
- Join our Discord for support and updates
Our documentation is continuously improving! If you have questions or need assistance, please reach out in our Discord community.
Quickstart
File: quickstart.md
The HyperSync Query Builder lets you construct and run queries directly in your browser — no install, no code required. It's the fastest way to get familiar with HyperSync and see what's possible.
Get up and running with HyperSync in minutes. This guide will help you start accessing blockchain data at unprecedented speeds with minimal setup. For a conceptual overview before you dive in, see What is HyperSync?.
Quickest Start: Try LogTUI
Want to see HyperSync in action with zero setup? Try LogTUI, a terminal-based blockchain event viewer:
# Monitor Aave events on Arbitrum (no installation needed)
pnpx logtui aave arbitrum
Clone the Quickstart Repository
The fastest way to get started is to clone our minimal example repository:
git clone https://github.com/enviodev/hypersync-quickstart.git
cd hypersync-quickstart
This repository contains everything you need to start streaming blockchain data using HyperSync.
Install Dependencies
# Using pnpm (recommended)
pnpm install
Choose Your Adventure
The repository includes three different script options, all of which retrieve Uniswap V3 events from Ethereum mainnet:
# Run minimal version (recommended for beginners)
node run-simple.js
# Run full version with progress bar
node run.js
# Run version with terminal UI
node run-tui.js
That's it! You're now streaming data directly from Ethereum mainnet through HyperSync! (TUI version below)
Understanding the Code
Let's look at the core concepts in the example code:
1. Initialize the Client
// Initialize Hypersync client
const client = new HypersyncClient({
url: "https://eth.hypersync.xyz", // Change this URL for different networks
apiToken: process.env.ENVIO_API_TOKEN!,
});
Note: To connect to different networks, see the Supported Networks page for a complete list of available URLs.
2. Build Your Query
The heart of HyperSync is the query object, which defines what data you want to retrieve:
let query = {
fromBlock: 0, // Start block (0 = genesis)
logs: [
// Filter for specific events
{
topics: [topic0_list], // Event signatures we're interested in
},
],
fieldSelection: {
// Only return fields we need
log: [
"Data",
"Address",
"Topic0",
"Topic1",
"Topic2",
"Topic3",
],
},
};
3. Stream and Process Results
// Start streaming events
const stream = await client.stream(query, {});
while (true) {
const res = await stream.recv();
// Process results
if (res.data && res.data.logs) {
// Do something with the logs
totalEvents += res.data.logs.length;
}
// Update starting block for next batch
if (res.nextBlock) {
query.fromBlock = res.nextBlock;
}
}
Key Concepts for Building Queries
Filtering Data
HyperSync lets you filter blockchain data in several ways:
- Log filters: Find specific events by contract address and event signature
- Transaction filters: Filter by sender/receiver addresses, method signatures, etc.
- Trace filters: Access internal transactions and state changes (only supported on select networks like Ethereum Mainnet)
- Block filters: Get data from specific block ranges
Field Selection
One of HyperSync's most powerful features is the ability to retrieve only the fields you need:
fieldSelection: {
// Block fields
block: ["Number", "Timestamp"],
// Log fields
log: ["Address", "Topic0", "Data"],
// Transaction fields
transaction: ["From", "To", "Value"],
}
This selective approach dramatically reduces unnecessary data transfer and improves performance.
Join Modes
HyperSync allows you to control how related data is joined:
- JoinNothing: Return only exact matches
- JoinAll: Return matches plus all related objects
- JoinTransactions: Return matches plus their transactions
- Default: Return a reasonable set of related objects
Examples
Finding Uniswap V3 Events
This example (from the quickstart repo) streams all Uniswap V3 events from the beginning of Ethereum:
// Define Uniswap V3 event signatures
const event_signatures = [
"PoolCreated(address,address,uint24,int24,address)",
"Burn(address,int24,int24,uint128,uint256,uint256)",
"Initialize(uint160,int24)",
"Mint(address,address,int24,int24,uint128,uint256,uint256)",
"Swap(address,address,int256,int256,uint160,uint128,int24)",
];
// Create topic0 hashes from event signatures
const topic0_list = event_signatures.map((sig) => keccak256(toHex(sig)));
// Initialize Hypersync client
const client = new HypersyncClient({
url: "https://eth.hypersync.xyz",
apiToken: process.env.ENVIO_API_TOKEN!,
});
// Define query for Uniswap V3 events
let query = {
fromBlock: 0,
logs: [
{
topics: [topic0_list],
},
],
fieldSelection: {
log: [
"Data",
"Address",
"Topic0",
"Topic1",
"Topic2",
"Topic3",
],
},
};
const main = async () => {
console.log("Starting Uniswap V3 event scan...");
const stream = await client.stream(query, {});
// Process stream...
};
main();
Supported Networks
HyperSync supports EVM-compatible networks. You can change networks by simply changing the client URL:
// Ethereum Mainnet
const client = new HypersyncClient({
url: "https://eth.hypersync.xyz",
apiToken: process.env.ENVIO_API_TOKEN!,
});
// Arbitrum
const client = new HypersyncClient({
url: "https://arbitrum.hypersync.xyz",
apiToken: process.env.ENVIO_API_TOKEN!,
});
// Base
const client = new HypersyncClient({
url: "https://base.hypersync.xyz",
apiToken: process.env.ENVIO_API_TOKEN!,
});
See the Supported Networks page for a complete list.
Using LogTUI
This quickstart repository powers LogTUI, a terminal-based blockchain event viewer built on HyperSync. LogTUI lets you monitor events from popular protocols across multiple chains with zero configuration.
Try it with a single command:
# Monitor Uniswap events on unichain
pnpx logtui uniswap-v4 unichain
# Monitor Aave events on Arbitrum
pnpx logtui aave arbitrum
# See all available options
pnpx logtui --help
LogTUI supports scanning historically for any events across all networks supported by HyperSync.
Next Steps
You're now ready to build with HyperSync! Here are some resources for diving deeper:
- Client Libraries - Explore language-specific clients
- Query Reference - Learn advanced query techniques
- Build queries visually - Use our Intuitive Query Builder
- curl Examples - Test queries directly in your terminal
- Complete Getting Started Guide - More comprehensive guidance
API Token
An API token is required to use HyperSync. Get an API token and set it as an environment variable:
export ENVIO_API_TOKEN="your-api-token-here"
Congratulations! You've taken your first steps with HyperSync, bringing ultra-fast blockchain data access to your applications. Happy building!
Getting Started with HyperSync
File: hypersync-usage.md
The HyperSync Query Builder lets you construct and run queries directly in your browser — no install, no code required. It's the fastest way to get familiar with HyperSync and see what's possible.
HyperSync is Envio's high-performance blockchain data engine that provides up to 2000x faster access to blockchain data compared to traditional RPC endpoints. This guide will help you understand how to effectively use HyperSync in your applications.
Quick Start Video
Watch this quick tutorial to see HyperSync in action:
Core Concepts
HyperSync revolves around two main concepts:
- Queries - Define what blockchain data you want to retrieve
- Output Configuration - Specify how you want that data formatted and delivered
Think of queries as your data filter and the output configuration as your data processor.
Building Effective Queries
Queries are the heart of working with HyperSync. They allow you to filter for specific blocks, logs, transactions, and traces.
Query Structure
A basic HyperSync query contains:
query = hypersync.Query(
from_block=12345678, # Required: Starting block number
to_block=12345778, # Optional: Ending block number
field_selection=field_selection, # Required: What fields to return
logs=[log_selection], # Optional: Filter for specific logs
transactions=[tx_selection], # Optional: Filter for specific transactions
traces=[trace_selection], # Optional: Filter for specific traces
include_all_blocks=False, # Optional: Include blocks with no matches
max_num_blocks=1000, # Optional: Limit number of blocks processed
max_num_transactions=5000, # Optional: Limit number of transactions processed
max_num_logs=5000, # Optional: Limit number of logs processed
max_num_traces=5000 # Optional: Limit number of traces processed
)
Field Selection
Field selection allows you to specify exactly which data fields you want to retrieve. This improves performance by only fetching what you need:
field_selection = hypersync.FieldSelection(
# Block fields you want to retrieve
block=[
BlockField.NUMBER,
BlockField.TIMESTAMP,
BlockField.HASH
],
# Transaction fields you want to retrieve
transaction=[
TransactionField.HASH,
TransactionField.FROM,
TransactionField.TO,
TransactionField.VALUE
],
# Log fields you want to retrieve
log=[
LogField.ADDRESS,
LogField.TOPIC0,
LogField.TOPIC1,
LogField.TOPIC2,
LogField.TOPIC3,
LogField.DATA,
LogField.TRANSACTION_HASH
],
# Trace fields you want to retrieve (if applicable)
trace=[
TraceField.ACTION_FROM,
TraceField.ACTION_TO,
TraceField.ACTION_VALUE
]
)
Filtering for Specific Data
For most use cases, you'll want to filter for specific logs, transactions, or traces:
Log Selection Example
# Filter for Transfer events from USDC contract
log_selection = hypersync.LogSelection(
address=["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], # USDC contract
topics=[
["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"] # Transfer event signature
]
)
Transaction Selection Example
# Filter for transactions to the Uniswap V3 router
tx_selection = hypersync.TransactionSelection(
to=["0xE592427A0AEce92De3Edee1F18E0157C05861564"] # Uniswap V3 Router
)
Processing the Results
HyperSync provides multiple ways to process query results:
Stream to Parquet Files
Parquet is the recommended format for large data sets:
# Configure output format
config = hypersync.StreamConfig(
hex_output=hypersync.HexOutput.PREFIXED,
event_signature="Transfer(address indexed from, address indexed to, uint256 value)"
)
# Stream results to a Parquet file
await client.collect_parquet("data_directory", query, config)
Stream to JSON Files
For smaller datasets or debugging:
# Stream results to JSON
await client.collect_json("output.json", query, config)
Process Data in Memory
For immediate processing:
# Process data directly
async for result in client.stream(query, config):
for log in result.logs:
# Process each log
print(f"Transfer from {log.event_params['from']} to {log.event_params['to']}")
Tips and Best Practices
Performance Optimization
-
Use Appropriate Batch Sizes: Adjust batch size based on your chain and use case:
config = hypersync.ParquetConfig(
path="data",
hex_output=hypersync.HexOutput.PREFIXED,
batch_size=1000000, # Process 1M blocks at a time
concurrency=10, # Use 10 concurrent workers
) -
Enable Trace Logs: Set
RUST_LOG=traceto see detailed progress:export RUST_LOG=trace -
Paginate Large Queries: HyperSync requests have a 5-second time limit. For large data sets, paginate results:
current_block = start_block
while current_block < end_block:
query.from_block = current_block
query.to_block = min(current_block + 1000000, end_block)
result = await client.collect_parquet("data", query, config)
current_block = result.end_block + 1
Network-Specific Considerations
- High-Volume Networks: For networks like Ethereum Mainnet, use smaller block ranges or more specific filters
- Low-Volume Networks: For smaller chains, you can process the entire chain in one query
Complete Example
Here's a complete example that fetches all USDC Transfer events:
import hypersync
from hypersync import (
LogSelection,
LogField,
BlockField,
FieldSelection,
TransactionField,
HexOutput
)
import asyncio
async def collect_usdc_transfers():
# Initialize client
client = hypersync.HypersyncClient(
hypersync.ClientConfig(
url="https://eth.hypersync.xyz",
bearer_token="your-token-here", # Get from https://docs.envio.dev/docs/HyperSync/api-tokens
)
)
# Define field selection
field_selection = hypersync.FieldSelection(
block=[BlockField.NUMBER, BlockField.TIMESTAMP],
transaction=[TransactionField.HASH],
log=[
LogField.ADDRESS,
LogField.TOPIC0,
LogField.TOPIC1,
LogField.TOPIC2,
LogField.DATA,
]
)
# Define query for USDC transfers
query = hypersync.Query(
from_block=12000000,
to_block=12100000,
field_selection=field_selection,
logs=[
LogSelection(
address=["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"], # USDC contract
topics=[
["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"] # Transfer signature
]
)
]
)
# Configure output
config = hypersync.StreamConfig(
hex_output=HexOutput.PREFIXED,
event_signature="Transfer(address indexed from, address indexed to, uint256 value)"
)
# Collect data to a Parquet file
result = await client.collect_parquet("usdc_transfers", query, config)
print(f"Processed blocks {query.from_block} to {result.end_block}")
asyncio.run(collect_usdc_transfers())
Decoding Event Logs
When working with blockchain data, event logs contain encoded data that needs to be properly decoded to extract meaningful information. HyperSync provides powerful decoding capabilities to simplify this process.
Understanding Log Structure
Event logs in Ethereum have the following structure:
- Address: The contract that emitted the event
- Topic0: The event signature hash (keccak256 of the event signature)
- Topics 1-3: Indexed parameters (up to 3)
- Data: Non-indexed parameters packed together
Using the Decoder
HyperSync's client libraries include a Decoder class that can parse these raw logs into structured data:
// Create a decoder with event signatures
const decoder = Decoder.fromSignatures([
"Transfer(address indexed from, address indexed to, uint256 amount)",
"Approval(address indexed owner, address indexed spender, uint256 amount)",
]);
// Decode logs
const decodedLogs = await decoder.decodeLogs(logs);
Single vs. Multiple Event Types
HyperSync provides flexibility to decode different types of event logs:
-
Single Event Type: For processing one type of event (e.g., only Swap events)
- See complete example: run-decoder.js
-
Multiple Event Types: For processing different events from the same contract (e.g., Transfer and Approval)
- See complete example: run-decoder-multi.js
Working with Decoded Data
After decoding, you can access the log parameters in a structured way:
- Indexed parameters: Available in
decodedLog.indexedarray - Non-indexed parameters: Available in
decodedLog.bodyarray
Each parameter object contains:
- name: The parameter name from the signature
- type: The Solidity type
- val: The actual value
For example, to access parameters from a Transfer event:
// Access indexed parameters (from, to)
const from = decodedLog.indexed[0]?.val.toString();
const to = decodedLog.indexed[1]?.val.toString();
// Access non-indexed parameters (amount)
const amount = decodedLog.body[0]?.val.toString();
Benefits of Using the Decoder
- Type Safety: Values are properly converted to their corresponding types
- Simplified Access: Direct access to named parameters
- Batch Processing: Decode multiple logs with a single call
- Multiple Event Support: Handle different event types in the same processing pipeline
Subscribing to the Chain Head (SSE)
Once you're caught up to the tip of the chain, polling GET /height in a loop is a wasteful way to notice new blocks. GET /height/sse is a Server-Sent Events endpoint that pushes the head to you instead: one long-lived HTTP GET, no WebSocket upgrade, and the server writes a record every time the height moves.
It carries the height and nothing else — no blocks, logs or transactions. Use it to learn when there's new data, then run a normal query to fetch it. (Not to be confused with Stream Config & Tuning, which is about pulling historical data fast.)
Wire format
GET https://eth.hypersync.xyz/height/sse, authenticated with the same API token as your queries. Two event types come down the stream:
event: height
data: 25731849
event: ping
data:
dataon aheightevent is a bare decimal integer, not JSON.pingis a liveness signal, sent at least every 5 seconds while the height is unchanged. Ignore the payload, but reset your read timeout on it.- The current head is re-sent on every connect, so ignore any height less than or equal to the one you already have.
To watch it directly: curl -sSN "https://eth.hypersync.xyz/height/sse" (-N disables buffering).
JavaScript
The token has to go in the Authorization header — it is not accepted as a query parameter, and adding one makes the request fail. The EventSource built into Node and browsers can't set headers, so it can't authenticate. HyperIndex solves this with the eventsource package (v4+), which lets you supply your own fetch:
let lastHeight = 0;
const es = new EventSource("https://eth.hypersync.xyz/height/sse", {
fetch: (url, init) =>
fetch(url, {
...init,
// Merge — replacing init.headers drops what the library sets for you
headers: {
...init.headers,
Authorization: `Bearer ${process.env.ENVIO_API_TOKEN}`,
},
}),
});
es.addEventListener("height", (event) => {
const height = Number(event.data);
// The head is re-sent on every reconnect, so ignore what we've already seen
if (!Number.isFinite(height) || height <= lastHeight) return;
lastHeight = height;
console.log("new head:", height);
});
// Without this, a bad token fails silently — you just never get an event
es.onerror = (err) => console.error("stream error:", err.code, err.message);
If you're on Rust, the Rust client wraps all of this in stream_height() — use that instead of wiring up SSE yourself.
Next Steps
Now that you understand the basics of using HyperSync:
- Browse the Python Client or other language-specific clients
- Learn about advanced query options
- See example queries for common use cases
- Get your API token to start building
For detailed API references and examples in other languages, check our client documentation.
HyperSync Client Libraries
File: hypersync-clients.md
HyperSync provides powerful client libraries that enable you to integrate high-performance blockchain data access into your applications. These libraries handle the communication with HyperSync servers, data serialization/deserialization, and provide convenient APIs for querying blockchain data.
Quick Links
| Client | Resources |
|---|---|
| Node.js | 📝 API Docs · 📦 NPM · 💻 GitHub · 🧪 Examples |
| Python | 📦 PyPI · 💻 GitHub · 🧪 Examples |
| Rust | 📦 Crates.io · 📝 API Docs · 💻 GitHub · 🧪 Examples |
| Go (community) | 💻 GitHub · 🧪 Examples |
| API Tokens | 🔑 Get Tokens |
Client Overview
All HyperSync clients share these key features:
- High Performance: Built on a common Rust foundation for maximum efficiency
- Optimized Transport: Uses binary formats to minimize bandwidth and maximize throughput
- Consistent Experience: Similar APIs across all language implementations
- Automatic Pagination: Handles large data sets efficiently
- Event Decoding: Parses binary event data into structured formats
Choose the client that best matches your application's technology stack:
| Feature | Node.js | Python | Rust | Go |
|---|---|---|---|---|
| Async Support | ✅ | ✅ | ✅ | ✅ |
| Typing | TypeScript | Type Hints | Native | Native |
| Data Formats | JSON, Parquet | JSON, Parquet, CSV | JSON, Parquet | JSON, Parquet |
| Memory Efficiency | Good | Better | Best | Better |
| Installation | npm | pip | cargo | go get |
Node.js Client
The Node.js client provides a TypeScript-first experience for JavaScript developers.
Installation
# Using npm
npm install @envio-dev/hypersync-client
# Using yarn
yarn add @envio-dev/hypersync-client
# Using pnpm
pnpm add @envio-dev/hypersync-client
Python Client
The Python client provides a Pythonic interface with full type hinting support.
Installation
pip install hypersync