TriportRPC

eth_getLogs

Last updated:

eth_getLogs returns all event logs emitted on-chain that match a single filter object. It is the workhorse for indexing contract activity: ERC-20 Transfers, swaps, mints, governance events — anything emitted with LOG0LOG4.

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. For very large historic sweeps, page through the chain in bounded block windows rather than requesting the full history in one call (see Notes).

Parameters

This method takes no parameters.

Returns

eth_getLogs return value
FieldType
resultobject

Examples

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

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does eth_getLogs do?
Returns the array of event logs matching a filter — by block range or block hash, 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.