eth_getLogs - Cronos RPC Method
Query event logs on Cronos. Essential for indexing DeFi protocols, NFT marketplaces, and Crypto.com ecosystem integrations on the EVM-compatible Crypto.com blockchain.
Returns an array of all logs matching a given filter object on Cronos.
Why Cronos? Build on the EVM-compatible Crypto.com blockchain with fast finality and deep Crypto.com ecosystem integration.
Use Cases
The eth_getLogs method is essential for:
- Event indexing - Track contract events for DeFi protocols, NFT marketplaces, and Crypto.com ecosystem integrations
- Token transfers - Monitor ERC20/ERC721 transfers
- DeFi analytics - Track swaps, liquidity events, and more
- Notification systems - Alert on specific on-chain events
Cronos Rate Limits
Block Range Limit
On Cronos, eth_getLogs queries are subject to a maximum block range of 500 blocks. This means the difference between fromBlock and toBlock cannot exceed 500 blocks per request.
Additionally, each query can return a maximum of 10,000 log entries.
For querying larger block ranges, split your requests into smaller batches:
// Example: Query in 500-block batches
const BATCH_SIZE = 500;
let fromBlock = startBlock;
while (fromBlock <= endBlock) {
const toBlock = Math.min(fromBlock + BATCH_SIZE - 1, endBlock);
const logs = await provider.getLogs({ fromBlock, toBlock, ...filter });
// Process logs
fromBlock = toBlock + 1;
}Code Examples
Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32005 | Query returned more than 10000 results | Reduce block range |
| -32602 | Invalid params | Invalid filter parameters |
Related Methods
eth_newFilter- Create a filter for logseth_getFilterChanges- Poll filter for new logs
eth_call
Execute smart contract calls without creating transactions on Cronos. Essential for reading contract state for DeFi protocols, NFT marketplaces, and Crypto.com ecosystem integrations.
eth_newFilter
Create an event log filter on Cronos. Essential for event monitoring, contract activity tracking, and DeFi event streaming for DeFi protocols, NFT marketplaces, and Crypto.com ecosystem integrations.