eth_getFilterLogs - opBNB

Example code for the eth_getFilterLogs JSON-RPC method. Сomplete guide on how to use eth_getFilterLogs JSON-RPC in GetBlock.io Web3 documentation.

This method returns all logs matching a filter, regardless of when the filter was created. Unlike eth_getFilterChanges, this returns the full set of matches rather than just new events.

Parameters

Parameter
Type
Required
Description

filterId

string

Yes

The filter ID returned by eth_newFilter

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getFilterLogs",
    "params": [
        "0x16f1f5f5dc91c4a1d2e7e8b6c4d3f2e1"
    ],
    "id": "getblock.io"
}'

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": [
        {
            "address": "0x9e7c5e3e3a3b8e1aa0e2d4c7f9d4b0c8b8d5f1a2",
            "blockHash": "0x4f3a1d6e8c2b9a7e5d3f1c8a4b6e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b",
            "blockNumber": "0x2d4e8a3",
            "data": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ],
            "transactionHash": "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"
        }
    ]
}

Response Parameters

Field
Type
Description

result

array

Array of all logs matching the filter

Use Cases

  • Reading the full event history for a filter without recreating it

  • Backfilling state after process restart

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

The method is not supported by this node

429

Too Many Requests

Rate limit exceeded for your plan

-32000

Filter not found

Filter has expired or never existed

SDK Integration

Last updated

Was this helpful?