Skip to main content

eth_getFilterLogs

Returns an array of all logs matching filter with given id on the Polygon network. This method retrieves all accumulated logs that match the criteria of a previously created filter.

Parameters​

  • id (string, required): The filter ID to retrieve logs for (obtained from eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter)

Returns​

An array of log objects, or an empty array if no logs match the filter. Each log object contains:

  • address (string): Address from which this log originated
  • topics (array of strings): Array of 0 to 4 32-byte DATA topics. The first topic is the hash of the signature of the event
  • data (string): Contains non-indexed arguments of the log
  • blockNumber (string): Block number where this log was included (null when pending)
  • blockHash (string): Hash of the block where this log was included (null when pending)
  • transactionHash (string): Hash of the transaction that created this log (null when pending)
  • transactionIndex (string): Transaction index position in the block (null when pending)
  • logIndex (string): Integer of the log index position in the block (null when pending)
  • removed (boolean): true when the log was removed due to a chain reorganization, false if it's a valid log

Implementation Example​

curl -X POST https://api-polygon-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getFilterLogs",
"params": ["0x16"],
"id": 1
}'

Response Example​

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x1234567890abcdef1234567890abcdef12345678",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000009876543210fedcba9876543210fedcba98765432"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0x1b4",
"blockHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
"transactionHash": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"transactionIndex": "0x1",
"logIndex": "0x0",
"removed": false
}
]
}

Notes​

  • The filter must be created first using eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter
  • This method returns all logs accumulated since the filter was created
  • Filters timeout if not accessed within a certain time period (typically 5 minutes)
  • Use eth_getFilterChanges to get only new logs since the last poll
  • The removed field helps handle chain reorganizations

Need help? Contact our support team or check the Polygon documentation.