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
filterId
string
Yes
The filter ID returned by eth_newFilter
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getFilterLogs",
"params": ["0x1"],
"id": "getblock.io"
}'import axios from 'axios';
const url = 'https://shared.eu-central-1.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
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": []
}Response Parameters
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
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?