Using RPC as Your Indexing Data Source
HyperIndex supports indexing any EVM blockchain using RPC (Remote Procedure Call) as the data source. This page explains when and how to use RPC for your indexing needs.
When to Use RPC
While HyperSync is the recommended and default data source for optimal performance, there are scenarios where you might need to use RPC instead:
- Unsupported Networks: When indexing a blockchain network that isn't yet supported by HyperSync
- Custom Requirements: When you need specific RPC functionality not available in HyperSync
- Private Chains: When working with private or development EVM chains
Note: For networks that HyperSync supports, we strongly recommend using HyperSync rather than RPC. HyperSync provides significantly faster indexing performance (up to 100x) and doesn't require managing RPC endpoints or worrying about rate limits.
Configuring RPC in Your Indexer
Basic Configuration
To use RPC as your data source, you need to add an rpc_config section to your network configuration in the config.yaml file:
networks:
- id: 1 # Ethereum Mainnet
rpc_config:
url: https://eth-mainnet.your-rpc-provider.com # Your RPC endpoint
start_block: 15000000
contracts:
- name: MyContract
address: "0x1234..."
# Additional contract configuration...
The presence of the rpc_config section tells HyperIndex to use RPC instead of HyperSync for this network.
Advanced RPC Configuration
For more control over how your indexer interacts with the RPC endpoint, you can configure additional parameters:
networks:
- id: 1
rpc_config:
url: https://eth-mainnet.your-rpc-provider.com
initial_block_interval: 10000 # Initial number of blocks to fetch in each request
backoff_multiplicative: 0.8 # Factor to scale back block request size after errors
acceleration_additive: 2000 # How many more blocks to request when successful
interval_ceiling: 10000 # Maximum blocks to request in a single call
backoff_millis: 5000 # Milliseconds to wait after an error
query_timeout_millis: 20000 # Milliseconds before timing out a request
start_block: 15000000
# Additional network configuration...
Configuration Parameters Explained
| Parameter | Description | Recommended Value |
|---|---|---|
url | Your RPC endpoint URL | Depends on provider |
initial_block_interval | Starting block batch size | 1,000 - 10,000 |
backoff_multiplicative | How much to reduce batch size after errors | 0.5 - 0.9 |
acceleration_additive | How much to increase batch size on success | 500 - 2,000 |
interval_ceiling | Maximum blocks per request | 5,000 - 10,000 |
backoff_millis | Wait time after errors (ms) | 1,000 - 10,000 |
query_timeout_millis | Request timeout (ms) | 10,000 - 30,000 |
The optimal values depend on your RPC provider's performance and limits, as well as the complexity of your contracts and the data being indexed.