eth_getFilterLogs

Returns an array of all logs matching filter with given id.

🚧

NOTE: This method only works for filters creates with eth_newFilte, but not for filters created using eth_newBlockFilter or eth_newPendingTransactionFilter which will return "filter not found".

eth_getLogs vs. eth_getFilterLogs

These two computations will return the same results:

a) Calling eth_getLogs with params [<options>]

b) Calling eth_newFilter with params [<options>], getting a filter id <filterId> back, then calling eth_getFilterLogs with params [<filterId>]

Parameters

OBJECT - The filter options:

Object NameRequiredTypeDetail
fromBlock❌StringA hex code of an integer that represents the block number, or "latest" that represents the last mined block.
toBlock❌StringA hex code of an integer that represents the integer block number, or "latest" that represents the last mined block.
address❌String/ArrayContract address or a list of addresses from which logs should originate.
topics❌ArrayArray of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
blockHash❌StringRestricts the logs returned to the single block with the blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.
"params": [
  "unknown"
]

Result

An array of log objects, or an empty array if nothing has changed since last poll.

  • For filters created with eth_newBlockFilter , the return are block hashes (DATA, 32 Bytes), e.g. ["0x123456789..."].
  • For filters created with eth_newFilter, logs are objects with the following fields.

Result Fields

KeyTypeDetail
addressStringAddress from which this log originated.
blockHashStringHash of the block where this log was in. null if either the returned block is pending or the log is pending.
blockNumberStringA hex code of an integer that represents the block number where this log was in. null if either the returned block is pending or the log is pending.
dataStringContains one or more 32 Bytes non-indexed arguments of the log.
logIndexStringA hex code of an integer that represents the log index position in the block. null if the log is pending.
removedBooleantrue if the log was removed, due to a chain reorganization. false if the log is valid.
topicsArrayArray of 0 to 4 32 Bytes DATA of indexed log arguments.
transactionHashStringHash of the transactions this log was created from. null if the log is pending.
transactionIndexStringA hex code of an integer that represents the transactions index position log was created from. null if the log is pending.

Example

Request

curl <your-endpoint> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["unknown"],"id":1}'

Return

unknown
Language
Click Try It! to start a request and see the response here!