getLogs
REQUEST
HEADERS
REQUEST PARAMS
FILTER OBJECT
address
[optional] - a string representing the address (20 bytes) to check for balancefromBlock
[optional, default is "latest"] - an integer block number, or the string "latest", "earliest" or "pending"toBlock
[optional, default is "latest"] - an integer block number, or the string "latest", "earliest" or "pending"topics
[optional] - Array of 32 Bytes DATA topics. Topics are order-dependent.blockhash
:[optional] With the addition of EIP-234,blockHash
restricts the logs returned to the single block with the 32-byte hashblockHash
. UsingblockHash
is equivalent tofromBlock
=toBlock
= the block number with hashblockHash
. IfblockHash
is present in in the filter criteria, then neitherfromBlock
nortoBlock
are allowed.
EXAMPLE
RESPONSE
RESULT FIELDS
LOG OBJECTS
- An array of log objects, or an empty array if nothing has changed since last poll.logs are objects with following params:
removed
: true when the log was removed, due to a chain reorganization. false if it's a valid log.logIndex
: integer of the log index position in the block. null when its pending log.transactionIndex
: integer of the transactions index position log was created from. null when its pending log.transactionHash
: 32 Bytes - hash of the transactions this log was created from. null when its pending log.blockHash
: 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.blockNumber
: the block number where this log was in. null when its pending. null when its pending log.address
: 20 Bytes - address from which this log originated.data
: contains one or more 32 Bytes non-indexed arguments of the log.topics
: Array of 0 to 4 32 Bytes of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
BODY
LIMITATIONS
To prevent queries from consuming too many resources, eth_getLogs
requests are currently limited by two constraints:
A max of 10,000 results can be returned by a single query
Query duration must not exceed 10 seconds
If a query returns too many results or exceeds the max query duration, one of the following errors is returned:
If this happens:
Limit your query to a smaller number of blocks using
fromBlock
andtoBlock
.If querying for commonly used
topics
, consider limiting to a single Smart Contractaddress
as well.
Last updated