eth_getLogs - Avalanche

eth_getLogs. Retrieve log entries that match specific filter criteria

eth_getLogs - avalanche [Value: 60CU]
Returns an array of all logs matching a given filter object
Use cases

Use cases

  • Retrieve event logs from specific smart contract addresses
  • Monitor emitted events within a defined block range
  • Filter logs by topics for transaction analysis
Constraints

Constraints

  • A maximuim of 5,000 parameters in a single request
  • A maximum of 10,000 results can be returned by a single query
  • Query duration must not exceed 10 seconds
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
    --url https://avalanche.drpc.org \
    --header 'accept: application/json' \
    --header 'content-type: application/json' \
    --data '
{
 "id": 1,
 "jsonrpc": "2.0",
 "method": "eth_getLogs",
 "params": [
   {
     "address": [
       "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907"
     ],
     "fromBlock": "0x429d3b",
     "toBlock": "latest",
     "topics": [
       "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
       "0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
       "0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
     ]
   }
 ]
}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
      "blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
      "blockNumber": "0x429d3b",
      "data": "0x000000000000000000000000000000000000000000000000000000012a05f200",
      "logIndex": "0x56",
      "removed": false,
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
        "0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
      ],
      "transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b",
      "transactionIndex": "0xac"
    }
  ]
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray of objects
array of objects
blockHashstring
The block hash to filter logs from. If this parameter is present, then the fromBlock and toBlock parameters are ignored.
addressstring
Contract address or a list of addresses from which logs should originate.
fromBlockstring
toBlockstring
The block number or block hash to search up to
  • latest [default] - the blockchain's most recent block
  • safe - a block validated by the beacon chain
  • finalized - a block confirmed by over two-thirds of validators
  • earliest - the first or genesis block
  • pending - transactions broadcasted but not yet included in a block
topicsarray
Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with 'or' options.

Response

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

Response params

object
idinteger
jsonrpcstring
resultarray_of_objects
Array of log objects, or an empty array if nothing has changed since last poll.
object
blockHashstring
32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log
blockNumberstring
The block number where this log was in. null when its pending. null when its pending log.
transactionIndexstring
Integer of the transactions index position log was created from. null when its pending log.
addressstring
20 Bytes - address from which this log originated.
logIndexstring
Integer of the log index position in the block. null when its pending log.
datastring
Contains one or more 32 Bytes non-indexed arguments of the log.
removedboolean
true when the log was removed, due to a chain reorganization. false if its a valid log.
topicsarray_of_strings
Array of zero to four 32 Bytes DATA 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 declare the event with the anonymous specifier.
transactionHashstring
Hash of the transactions this log was created from. null when its pending log.