TriportRPC

eth_getLogs

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

eth_getLogs returns all event logs emitted on Polygon that match a single filter object. It is the primary event-indexing primitive: ERC-20 Transfers, DEX swaps, mints, bridge events — anything emitted with LOG0LOG4 on Polygon mainnet (Bor consensus).

You select logs in one of two mutually exclusive ways:

  • By block range — set fromBlock and toBlock (tags or hex block numbers). The range is inclusive on both ends.
  • By a single block — set blockHash to pin the query to exactly one block. blockHash cannot be combined with fromBlock/toBlock.

Within that window you narrow further by address (one or many contracts) and by topics (the indexed event signature and arguments). The result is a flat, chronologically ordered array of log objects; an empty array means nothing matched (this is not an error).

This is a read method available from the free tier. Polygon's block time is ~2.1 s, so a given wall-clock window covers roughly 6× more blocks than the same window on Ethereum — keep ranges bounded. For high-frequency Polygon event streams (e.g. Uniswap-style swaps can exceed 10,000 events/minute) prefer a WebSocket subscription over polling eth_getLogs (see Notes).

Parameters

This method takes no parameters.

Returns

eth_getLogs return value
FieldType
resultobject

Examples

curl https://triport.io/polygon \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[]}'
const res = await fetch("https://triport.io/polygon", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": []
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/polygon",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Polygon.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_getLogs do?
Returns the array of event logs on Polygon matching a filter — by block range, contract address, and indexed topics.
How many credits does eth_getLogs cost?
eth_getLogs costs 1 credit(s) per call on Triport by default.
Is eth_getLogs available over WebSocket?
eth_getLogs is an HTTP JSON-RPC method.