eth_getLogs

Returns an array of all logs matching a given filter object.

Parameters

OBJECT - The filter options:

KeyRequiredTypeDetail
fromBlockStringA hex code of an integer that represents the block number, or "latest" that represents the last mined block.
toBlockStringA hex code of an integer that represents the integer block number, or "latest" that represents the last mined block.
addressString/ArrayContract address or a list of addresses from which logs should originate.
topicsArrayArray of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
blockHashStringRestricts 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":[
    {
        "fromBlock": "0xF9F3B7", 
        "toBlock": "0xF9F3B8"
    }
]

Result

It is 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_getLogs","params":[{"fromBlock": "0xF9F3B7", "toBlock": "0xF9F3B8"}],"id":0}'

Return

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
      {
          "address": "0xe618ef7c64afede59a81cef16d0161c914ebab17",
          "blockHash": "0x40daf6888666bedfa4cfb661ded2286e591a9140cb205b26e5135f63932cca56",
          "blockNumber": "0xf9f3b7",
          "data": "0x0000000000000000000000000000000000000010ffca8b374e554671fed88151",
          "logIndex": "0x0",
          "removed": false,
          "topics": [
              "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
              "0x00000000000000000000000011387090d0d40528f90b2750f630455484234d98",
              "0x00000000000000000000000081b3e23aae7cba1041d308e8dfdba5e074867cc3"
          ],
          "transactionHash": "0xd4fcc07fc00dc5c51191f2a4f4df6e6cdfaa427559c1034dc723e7b8626ec847",
          "transactionIndex": "0x0"
      },
      ...
      {
          "address": "0x0000000000000000000000000000000000001000",
          "blockHash": "0x2b0a75c56832ccd9034078580834632dcd0277c3a3347c72dff3765dff867ea4",
          "blockNumber": "0xf9f3b8",
          "data": "0x00000000000000000000000000000000000000000000000001210c44b2fa6932",
          "logIndex": "0x19b",
          "removed": false,
          "topics": [
              "0x93a090ecc682c002995fad3c85b30c5651d7fd29b0be5da9d784a3302aedc055",
              "0x000000000000000000000000e2d3a739effcd3a99387d015e260eefac72ebea1"
          ],
          "transactionHash": "0xe6135086a98a819f4c048ec987b2df06deb588a8bb36e9bba24b1c31cb3ad8f2",
          "transactionIndex": "0x88"
      }
  ]
}
Language
Click Try It! to start a request and see the response here!