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 `Transfer`s, swaps, mints, governance events — anything emitted with `LOG0`–`LOG4`.
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](#notes)).
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_getLogs",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getLogs","params":[],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- 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.