eth_getLogs - Polygon

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

Parameters

Object - The filter options:

  • fromBlock: QUANTITY|TAG - (optional, default: "latest") Value:

  • Integer block number

  • "latest" for the last mined block

  • address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.

  • topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics.

    • Topics are order-dependent. Each topic can also be an array of DATA with "or" options.

  • blockHash: DATA, 32 Bytes - (optional) With the addition of EIP-234 (Geth >= v1.8.13 or Parity >= v2.1.0), blockHash is a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.

params: [
  {
    "address": "0x0000000000000000000000000000000000001010",
    "topics": [
      "0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4"
    ],
    "blockHash": "0x4acde13c82106a719dbe4751fccb70dee8df86975dd387db9f0c85745005c518"
  }
]

Returns

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

  • removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.

  • logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.

  • transactionIndex: QUANTITY - integer of the transactions index position log was created from. null when its pending log.

  • transactionHash: DATA, 32 Bytes - hash of the transactions this log was created from. null when its pending log.

  • blockHash: DATA, 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.

  • blockNumber: QUANTITY - the block number where this log was in. null when its pending. null when its pending log.

  • address: DATA, 20 Bytes - address from which this log originated.

  • data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.

  • topics: Array of DATA - Array of 0 to 4 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.

Request example

curl https://polygon.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address": "0x0000000000000000000000000000000000001010","topics": ["0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4"],"blockHash": "0x4acde13c82106a719dbe4751fccb70dee8df86975dd387db9f0c85745005c518"}],"id":0}'

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
        {
            "address": "0x0000000000000000000000000000000000001010",
            "blockHash": "0x5529b5c5bae3ac668620357b2568fd16385c7a2f7efcaad003c5db409f9d0c8f",
            "blockNumber": "0x1d769f3",
            "data": "0x00000000000000000000000000000000000000000000002091222ecb6f9ccf96000000000000000000000000000000000000000000bd79b756dd8480b42942aa00000000000000000000000000000000000000000000000b01c7a2eecb8f32b3000000000000000000000000000000000000000000bd7996c5bb55b5448c731400000000000000000000000000000000000000000000002b92e9d1ba3b2c0249",
            "logIndex": "0x15",
            "topics": [
                "0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4",
                "0x0000000000000000000000000000000000000000000000000000000000001010",
                "0x0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
                "0x000000000000000000000000f2e4209afa4c3c9eaa3fb8e12eed25d8f328171c"
            ],
            "transactionHash": "0x95f3abcd1aff62b8f4116358d0e14a6b97ffe8dbab5fb6de38d7ff25aebfb630",
            "transactionIndex": "0x2",
            "removed": false
        },
        {
            "address": "0x0000000000000000000000000000000000001010",
            "blockHash": "0x5529b5c5bae3ac668620357b2568fd16385c7a2f7efcaad003c5db409f9d0c8f",
            "blockNumber": "0x1d769f3",
            "data": "0x00000000000000000000000000000000000000000000002091222ecb6f9ccf9600000000000000000000000000000000000000000000002b92e9d1ba3b2c02490000000000000000000000000000000000000000000000cf8c0df06442c1499200000000000000000000000000000000000000000000000b01c7a2eecb8f32b30000000000000000000000000000000000000000000000f01d301f2fb25e1928",
            "logIndex": "0x17",
            "topics": [
                "0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4",
                "0x0000000000000000000000000000000000000000000000000000000000001010",
                "0x000000000000000000000000f2e4209afa4c3c9eaa3fb8e12eed25d8f328171c",
                "0x0000000000000000000000007e243cbf9eee0f7cc269c220beaa1dd8a27eec38"
            ],
            "transactionHash": "0x95f3abcd1aff62b8f4116358d0e14a6b97ffe8dbab5fb6de38d7ff25aebfb630",
            "transactionIndex": "0x2",
            "removed": false
        },
        {
            "address": "0x0000000000000000000000000000000000001010",
            "blockHash": "0x5529b5c5bae3ac668620357b2568fd16385c7a2f7efcaad003c5db409f9d0c8f",
            "blockNumber": "0x1d769f3",
            "data": "0x0000000000000000000000000000000000000000000000000058d15e1762800000000000000000000000000000000000000000000000006bb0eaa4d9271b1d2000000000000000000000000000000000000000000000000000082bd50be3c08800000000000000000000000000000000000000000000006bb091d37b0fb89d200000000000000000000000000000000000000000000000000060fd3323464088",
            "logIndex": "0x56",
            "topics": [
                "0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4",
                "0x0000000000000000000000000000000000000000000000000000000000001010",
                "0x000000000000000000000000377de3d76d59bbfeb533ce2722c69f5294a520d3",
                "0x0000000000000000000000007652bead345ccf1196c7159480694005f3b96cb8"
            ],
            "transactionHash": "0xb026fad1e3c4790734ec72c297af6ee1ef3231a5b00d3ad27bf7d8caf9dd626b",
            "transactionIndex": "0x14",
            "removed": false
        }
    ]
}

Last updated