eth_getLogs

Parameters

  1. Object - The filter options, which include the following fields:

    FieldTypeDescription
    fromBlockQUANTITY|TAG(optional, default: "latest") The block number from which to start searching for logs, or "latest" for the most recently mined block.
    toBlockQUANTITY|TAG(optional, default: "latest") The block number at which to stop searching for logs, or "latest" for the most recently mined block.
    addressDATA|Array, 20 Bytes(optional) A contract address or a list of addresses from which logs should originate.
    topicsDATA[](optional) An array of 32-byte DATA topics. Topics are order-dependent. Each topic may also be an array of DATA representing "or" options.
    blockHashDATA, 32 Bytes(optional) Restricts the logs returned to a single block identified by this 32-byte hash. Using blockHash is equivalent to setting fromBlock and toBlock to the block number of the referenced block. If blockHash is provided, fromBlock and toBlock must not be included.

Returns


Example

Request

curl -X POST https://api.shasta.trongrid.io/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
      {
        "address": "0x42a1e39aefa49290f2b3f9ed688d7cecf86cd6e0",
        "fromBlock": "0x3E8A920",
        "toBlock": "0x3E8A984",
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x0000000000000000000000001975fbea3496424a88de2a147d76baa34a3d1b93",
          "0x000000000000000000000000c3abfbceb364febe625662a9af6add366df58f81"
        ]
      }
    ],
    "id": 1
  }'

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0x42a1e39aefa49290f2b3f9ed688d7cecf86cd6e0",
      "blockHash": "0x0000000003e8a947c68442f90bb271d2f7b1b8bb86f6a78a1d4f2d53ab92d81d",
      "blockNumber": "0x3e8a947",
      "data": "0x0000000000000000000000000000000000000000000000000000000000736201",
      "logIndex": "0x0",
      "removed": false,
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x0000000000000000000000001975fbea3496424a88de2a147d76baa34a3d1b93",
        "0x000000000000000000000000c3abfbceb364febe625662a9af6add366df58f81"
      ],
      "transactionHash": "0xba60eb123d557f6b9ffefae573499b9d65ee15430a55b24cb28ef4ab2118f814",
      "transactionIndex": "0x1"
    },
    {
      "address": "0x42a1e39aefa49290f2b3f9ed688d7cecf86cd6e0",
      "blockHash": "0x0000000003e8a98485e380e81c900ce531d124381f8a9cb9e7572b2b6a1cb768",
      "blockNumber": "0x3e8a984",
      "data": "0x0000000000000000000000000000000000000000000000000000000000736201",
      "logIndex": "0x0",
      "removed": false,
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x0000000000000000000000001975fbea3496424a88de2a147d76baa34a3d1b93",
        "0x000000000000000000000000c3abfbceb364febe625662a9af6add366df58f81"
      ],
      "transactionHash": "0xab71e8940566476af8ba7663b53f938173968add3fae77aa4a899e3facdfab3f",
      "transactionIndex": "0x0"
    }
  ]
}