eth_getLogs - Ethereum

Shows you an array which contains all logs that suit the filter with the stated filter objects

How to Use the eth_getLogs Method

The size of response for getFilterLogs method varies due to your block range:

  • Block range > 50K: unavailable

  • Block range <= 100: No limitations

  • Block range between 100 and 50K: No more than 50K records can be responded

Parameters

Object - The following available filter options:

  • address [variable] - a string that shows the address (20 bytes) which balances you want to look up

  • fromBlock [variable, default is "latest"] - the string "latest", "earliest" or "pending", or an integer block number

  • toBlock [variable, default is "latest"] - the string "latest", "earliest" or "pending", or an integer block number"

  • topics[variable] - Array of 32 Bytes order-dependent DATA topics.

  • blockhash:[variable] If you add EIP-234, blockHash will restrict the logs returned to the single block with the 32-byte hash blockHash. Using blockHash has the same meaning as fromBlock = toBlock = the block number with hash blockHash. If blockHash you add in the filter criteria, then neither fromBlock nor toBlock won’t be available.

What you receive

LOG OBJECTS - Array with log objects in it. In case if nothing has changed since the last poll you’ll receive an empty one.

  • logs will be presented as objects with parameters stated below:

    • removed: TAG - true in case of the log removal, because of a chain reorganization. false if it's an existing actual log.

    • logIndex: QUANTITY - the log index position presented as an integer. returns null in case of a pending log.

    • transactionIndex: QUANTITY - the transactions index position log was created from, has an integer form. null in case of a pending log.

    • transactionHash: DATA, 32 Bytes - transactions’ hash that has created this log. returns null in case of a pending log.

    • blockHash: DATA, 32 Bytes - the block’s hash where this log was located. returns null in case of a pending log.

    • blockNumber: QUANTITY - the block’s number where this log was located. returns null in case of a pending log.

    • address: DATA, 20 Bytes - the log’s origination address.

    • data: DATA - a param with the log’s non-indexed arguments.

    • topics: Array of DATA - contains from 0 to 4 32 Bytes DATA with indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (such as Deposit(address,bytes32,uint256)), unless the event declaration is with the anonymous specifier.)

Sample

Here is a typical appliance example.

Call

Outcome

Last updated