eth_getLogs
JSON-RPC method returns event logs that match specified filter criteria. This method is essential for retrieving smart contract events, monitoring contract activity, and building event-driven applications on the blockchain.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
The method takes one parameter: a filter object that specifies the criteria for log retrieval.Filter object
address
(string or array, optional) — Contract address(es) to filter logs fromfromBlock
(string, optional) — Starting block number in hexadecimal (default:"latest"
)toBlock
(string, optional) — Ending block number in hexadecimal (default:"latest"
)topics
(array, optional) — Array of topic filters for event matchingblockhash
(string, optional) — Block hash to filter logs from (alternative to block range)
Parameter details
Address filtering:- Single address:
"0x1234..."
- Multiple addresses:
["0x1234...", "0x5678..."]
- Omit to get logs from all contracts
fromBlock
andtoBlock
define the range- Use
"latest"
,"earliest"
,"pending"
, or hex block numbers - Maximum range is 50 blocks on Hyperliquid
- Array of up to 4 topic filters (indexed event parameters) - Hyperliquid limitation
- Each topic can be
null
(any value), string (exact match), or array (multiple options) - Topics correspond to event signature and indexed parameters
Response
The method returns an array of log objects matching the filter criteria.Response structure
Log object:address
— Contract address that emitted the logtopics
— Array of indexed event parameters (including event signature)data
— Non-indexed event parameters as hexadecimal stringblockNumber
— Block number containing the logblockHash
— Hash of the block containing the logtransactionHash
— Hash of the transaction that generated the logtransactionIndex
— Index of the transaction in the blocklogIndex
— Index of the log in the transactionremoved
— Boolean indicating if log was removed due to chain reorganization
Event decoding
Topic structure:topics[0]
— Event signature hash (keccak256 of event signature)topics[1-3]
— Indexed event parameters (if any)data
— Non-indexed parameters (ABI-encoded)
Event filtering
Address filtering
Single contract:Topic filtering
Specific event:Hyperliquid-specific limitations
Block range constraint
50-block limit:- Maximum query range is 50 blocks on Hyperliquid
- Use chunking for larger ranges
- Process blocks in batches to respect this limit
- Plan queries accordingly for historical analysis
Topic filtering
4-topic maximum:- Up to 4 topic filters are supported
- Each topic can be null, string, or array of strings
- Topics[0] is typically the event signature hash
- Topics[1-3] are indexed event parameters
Filter examples
Token transfers
All transfers:Multiple event types
Transfers and approvals:Example request
This an example call with wrapped HYPE (wHYPE) on the Hyperliquid mainnet deployed at 0x5555555555555555555555555555555555555555.Shell
Use cases
Theeth_getLogs
method is essential for applications that need to:
- Event monitoring: Monitor smart contract events within 50-block ranges
- DeFi analytics: Track token transfers, swaps, and protocol events
- Transaction analysis: Analyze contract interactions and state changes
- Audit systems: Track contract activity for compliance and security
- Portfolio tracking: Monitor user transactions and balance changes
- Market analysis: Analyze trading activity and market events
- Notification systems: Generate alerts based on specific events
- Data indexing: Build event databases with chunked processing
- Development tools: Debug and test smart contract event emissions
- Integration services: Provide event data to external systems
On Hyperliquid,
eth_getLogs
supports up to 4 topics and a maximum query range of 50 blocks. For larger ranges, use chunking to process blocks in batches of 50 or fewer.Body
application/json