Appearance
eth_getLogs
served · same as reth
Returns the logs that match a filter: a block range or one block, and optional addresses and topics.
When to use
Use it to read contract events, for example all ERC-20 Transfer events of a token in a block range. To follow new events, use eth_subscribe with logs, or a filter with eth_newFilter.
Example
bash
curl -s -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_getLogs", "params": [{"fromBlock": "0x18facaa", "toBlock": "0x18facaa", "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"}]}' \
http://127.0.0.1:8547json
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x18facaa",
"toBlock": "0x18facaa",
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
]
}Response
Live mainnet, block 26193066, 2026-10-14. Checked against reth 2.7: equal.
json
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000002744dfd9898f0babbc570cc594bbbc84b487a22b",
"0x000000000000000000000000b63c06ac4fba3cece04a794a55cebe6ef90e677c"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000cd1400",
"blockHash": "0x5ae7b3bea1d0773e6f124069319201fa7963401336f072a58f68bc3fee920047",
"blockNumber": "0x18facaa",
"blockTimestamp": "0x6acfe2c3",
"transactionHash": "0xefb01061a1bc1079515104c6a2c1988ecd800d869eda679b4dd644ddf8182745",
"transactionIndex": "0x1",
"logIndex": "0x0",
"removed": false
},
"... 16 more items"
]
}Parameters
| Name | Type | Required | Meaning |
|---|---|---|---|
filter | object, see Filter | yes | Which logs to return. All fields are optional. |
The main fields of filter. The Filter page has all of them.
| Field | Type | Meaning |
|---|---|---|
fromBlock | block number in hex, or a tag | The first block of the range, included. Default: latest. A number below the first block of the node gives the error 4444. |
toBlock | block number in hex, or a tag | The last block of the range, included. Default: latest. A number above the head gives the error -32602. |
address | address, or a list of addresses | Only logs from this contract, or from any contract in the list. Default: any address. |
topics | list of at most 4 items | One item per topic position. Each item is null (any topic), one topic, or a list of topics (any of them). |
blockHash | 32-byte hash | Only the logs of this one block. Cinder then ignores fromBlock and toBlock. |
Returns
A list of logs in block order, then in log order. An empty list when no log matches. See Log.
Notes and limits
toBlockminusfromBlockis at most 100 000 for each request. A range of exactly 100 000 is allowed.- The answer has at most 20 000 logs. A larger answer gives an error that names a smaller range to ask for.
- The logs reach back to the block where the node started (the
earliesttag). The node has no receipts for earlier blocks, and a range of at most 100 000 blocks that starts before it gives the error 4444. - The checks run in this order, as in reth:
toBlockabove the head,fromBlockabovetoBlock,fromBlockbelow the first block, the size of the range. - Ask for one contract and one event when you can. The node skips blocks whose bloom filter cannot match.
- The node also keeps a log filter row for each block: the fingerprints of the addresses and topics of its logs. A filter with an address or a topic reads the receipts only of the blocks whose row has them. Thus a filter with few matches is fast also over a wide range. A database of an older version has no rows for its blocks:
cinder --build-log-filters --db DIRwrites them. A node can run meanwhile, but its writer waits while each batch of 1 000 rows commits. Without a row, the node reads the block as before. The answer is the same with or without the rows. - With
fromBlockpending, the answer has the logs of the pending block only, as in reth. This is whentoBlockispending, is not given, or is a number not below the pending block. With another tag or a lower number astoBlock, the answer is an empty list. AtoBlockofpendingwith anotherfromBlockis the head.
Errors
| Code | Message | When |
|---|---|---|
| -32602 | block range extends beyond current head block: requested N, head M | toBlock is above the head. |
| -32602 | invalid block range params | fromBlock is above toBlock. A missing toBlock is the head, so a fromBlock above the head gives this error. |
| 4444 | pruned history unavailable: requested N, earliest available M | fromBlock, or the block of blockHash, is below the first block of the node. M is that block. The range limit comes first. reth checks its own first block before the range limit. |
| -32602 | query exceeds max block range 100000 | toBlock minus fromBlock is more than 100 000. |
| -32602 | query exceeds max results 20000, retry with the range FROM-N | More than 20 000 logs match. Ask again with the range in the message. |
| -32602 | Invalid params | A parameter is missing or does not parse. data has the text of reth, with the position. |
| -32001 | block not found: hash 0x... | blockHash is not a block on the canonical chain. |
Compared with reth
The limits are those of reth by default: 100 000 blocks (--rpc.max-blocks-per-filter) and 20 000 logs (--rpc.max-logs-per-response).
The live example above gives the same answer on Cinder and on reth 2.7.
Speed against reth
100 blocks, ~4 800 matching logs2.4x slower
Cinder116 ms
reth48 ms
Related methods
eth_newFilter, eth_getFilterLogs, eth_subscribe, eth_getTransactionReceipt.
Schema (OpenRPC)
The official specification: eth_getLogs in ethereum/execution-apis.
Parameter Filter: Filter by block range or Filter by block hash
json
{
"oneOf": [
{
"not": {
"required": [
"blockHash"
]
},
"properties": {
"address": {
"oneOf": [
{
"title": "Any Address",
"type": "null"
},
{
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "Address",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "hex encoded address",
"type": "string"
},
"title": "Addresses",
"type": "array"
}
],
"title": "Address(es)"
},
"fromBlock": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "from block",
"type": "string"
},
"toBlock": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "to block",
"type": "string"
},
"topics": {
"oneOf": [
{
"title": "Any Topic Match",
"type": "null"
},
{
"items": {
"oneOf": [
{
"pattern": "^0x[0-9a-f]{64}$",
"title": "Single Topic Match",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 hex encoded bytes",
"type": "string"
},
"title": "Multiple Topic Match",
"type": "array"
}
],
"title": "Filter Topic List Entry"
},
"title": "Specified Filter Topics",
"type": "array"
}
],
"title": "Topics"
}
},
"title": "Filter by block range",
"type": "object"
},
{
"properties": {
"address": {
"oneOf": [
{
"title": "Any Address",
"type": "null"
},
{
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "Address",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "hex encoded address",
"type": "string"
},
"title": "Addresses",
"type": "array"
}
],
"title": "Address(es)"
},
"blockHash": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "block hash",
"type": "string"
},
"topics": {
"oneOf": [
{
"title": "Any Topic Match",
"type": "null"
},
{
"items": {
"oneOf": [
{
"pattern": "^0x[0-9a-f]{64}$",
"title": "Single Topic Match",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 hex encoded bytes",
"type": "string"
},
"title": "Multiple Topic Match",
"type": "array"
}
],
"title": "Filter Topic List Entry"
},
"title": "Specified Filter Topics",
"type": "array"
}
],
"title": "Topics"
}
},
"required": [
"blockHash"
],
"title": "Filter by block hash",
"type": "object"
}
],
"title": "filter"
}Result: new block or transaction hashes or new logs
json
{
"oneOf": [
{
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 byte hex value",
"type": "string"
},
"title": "new block or transaction hashes",
"type": "array"
},
{
"items": {
"additionalProperties": false,
"properties": {
"address": {
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "address",
"type": "string"
},
"blockHash": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "block hash",
"type": "string"
},
"blockNumber": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "block number",
"type": "string"
},
"blockTimestamp": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "block timestamp",
"type": "string"
},
"data": {
"pattern": "^0x[0-9a-f]*$",
"title": "data",
"type": "string"
},
"logIndex": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "log index",
"type": "string"
},
"removed": {
"title": "removed",
"type": "boolean"
},
"topics": {
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 hex encoded bytes",
"type": "string"
},
"title": "topics",
"type": "array"
},
"transactionHash": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "transaction hash",
"type": "string"
},
"transactionIndex": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "transaction index",
"type": "string"
}
},
"required": [
"transactionHash"
],
"title": "log",
"type": "object"
},
"title": "new logs",
"type": "array"
}
],
"title": "Filter results"
}