Docs

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:

JavaScript
// 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 CodeMessageDescription
-32005Query returned more than 10000 resultsReduce block range
-32602Invalid paramsInvalid filter parameters