For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_getFilterLogs - Polygon

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

The eth_getFilterLogs method returns an array of all logs matching the filter with the given ID. Unlike eth_getFilterChanges, this returns all matching logs, not just changes since the last poll.

Parameters

Parameter
Type
Required
Description

filterId

string

Yes

The filter ID returned by eth_newFilter

Request

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

const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';

const payload = {
    jsonrpc: '2.0',
    method: 'eth_getFilterLogs',
    params: ["0x1"],
    id: 'getblock.io'
};

axios.post(url, payload, {
    headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

Response

response.json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": []
}

Response Parameters

Field
Type
Description

jsonrpc

string

JSON-RPC version (2.0)

id

string

Request identifier

result

varies

Array of log objects matching the filter

Use Case

The eth_getFilterLogs method is useful for:

  • Historical log retrieval

  • Event analysis

  • Contract interaction tracking

  • Audit trails

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

-32600

Invalid Request

Malformed request body

-32602

Invalid params

Invalid method parameters

Web3 Integration

Last updated

Was this helpful?