eth_getLogs

eth_getLogs(filterObject) → logArray

Returns an array of log entries (events) matching the supplied filter. Use this for historical queries — point-in-time scans of contract events. For live subscriptions, use eth_subscribe (logs topic) over WebSocket. Maroo follows Ethereum's filter semantics; topics are hashed event signatures and indexed parameters, encoded as bytes32.

Parameters

Name Type Required Description
filter object Filter object. Fields: fromBlock / toBlock (hex block number or latest / earliest / pending), address (single address or array — limits to logs from these contracts), topics (array of up to 4 elements; each element is a single 32-byte topic, an array of topics for OR-matching, or null to match anything), blockHash (alternative to from/to range — match logs from a single block).

Returns

Type: array

Array of log objects. Each log has: address, topics (bytes32[]), data (non-indexed event params, ABI-encoded), blockNumber, blockHash, transactionHash, transactionIndex, logIndex, removed (true if a chain reorg removed the log; rare on Maroo's instant-finality consensus).

Errors

Code Name Description
-32005 query returned more than N results Maroo's RPC node caps a single eth_getLogs response (typical limit: 10,000 logs). Narrow the block range or address filter and paginate with successive calls.
-32602 Invalid params The filter is malformed — invalid topic length, malformed fromBlock/toBlock, or both blockHash and a block-range field set.

Examples

ethers.js v6 — query ERC-20 Transfer events

id("Transfer(...)") computes keccak256 of the event signature — the value that lands in topics[0].

import { JsonRpcProvider, id } from "ethers";

const provider = new JsonRpcProvider("https://rpc-testnet.maroo.io");

const transferTopic = id("Transfer(address,address,uint256)");
const logs = await provider.getLogs({
  address: "0xTokenAddress",
  topics:  [transferTopic],
  fromBlock: 1_000_000,
  toBlock:   "latest",
});
console.log(`Found ${logs.length} Transfer events`);

Raw cURL — single block lookup

Topic 0 is the canonical Transfer(address,address,uint256) selector — same value across all EVM chains.

curl -X POST https://rpc-testnet.maroo.io \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [{
      "blockHash": "0xBlockHash...",
      "address":   "0xTokenAddress",
      "topics":    ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
    }],
    "id": 1
  }'
Source: maroo
ESC
Type to search