API Reference

cfx_getLogs - Conflux

Returns logs matching the filter provided.

Parameters

  • Object - A log filter object:
    • fromEpoch: QUANTITY|TAG - (optional, default: "latest_checkpoint") The epoch number, or the string "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter. Search will be applied from this epoch number.
    • toEpoch: QUANTITY|TAG - (optional, default: "latest_state") The epoch number, or the string "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter. Search will be applied up until (and including) this epoch number.
    • blockHashes: Array of DATA - (optional, default: null) Array of up to 128 block hashes that the search will be applied to. This will override from/to epoch fields if it's not null.
    • address: Array of BASE32 - (optional, default: null) Search contract addresses. If null, match all. If specified, the log must be produced by one of these contracts.
    • topics: Array - (optional, default: null) 32-byte earch topics. Logs can have 4 topics: the event signature and up to 3 indexed event arguments. The elements of topics match the corresponding log topics. Example: ["0xA", null, ["0xB", "0xC"], null] matches logs with "0xA" as the 1st topic AND ("0xB" OR "0xC") as the 3rd topic. If null, match all.
    • limit: QUANTITY - (optional, default: null) If null return all logs, otherwise should only return the last limit logs. Note: if the node has get_logs_filter_max_limit set, it will override limit if it is null or greater than the preset value.
    • offset: QUANTITY - If specified, the response will skip the last offset logs. For instance, with 10 matching logs (0..9) and offset=0x1, limit=0x5, the response will contain logs 4..8. Note: Even if you specify offset, the corresponding logs still need to be processed by the node, so a filter with offset=10000, limit=10 has about the same performance as a filter with offset=0, limit=100010

Returns

Array - array of log objects corresponding to the matching logs:

  • address: BASE32 - Address of the contract that emitted the log.
  • topics: Array of DATA - Array of 32-byte event topics.
  • data: DATA - data of log.
  • blockHash: DATA - 32 Bytes - Hash of the block containing the log.
  • epochNumber: QUANTITY - Epoch number of the block containing the log.
  • transactionHash: DATA, 32 Bytes - Hash of the transaction that created the log.
  • transactionIndex: QUANTITY - Transaction index in the block.
  • logIndex: QUANTITY - Log index in block.
  • transactionLogIndex: QUANTITY - Log index in transaction.

Example

Request

curl -X POST \
--data '{"jsonrpc":"2.0","method": "cfx_getLogs",
    "params":  [
        {
            "fromEpoch": "0x12dd1e3",
            "toEpoch": "0x12dd246",
            "address": "cfx:type.contract:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "limit": "0x2"
        }
    ],"id":1}' \
-H "Content-Type: application/json" \
https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577 


Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": [
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008531b4bd1662b7ca943a3d27794203c7ace53e7200000000000000000000000000000000000000000000008368a98cc8902bb80000000000000000000000000000000000000000000000008368a98cc8902bb800",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x0",
            "transactionLogIndex": "0x0"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000821c636dfc85d0612fb8ebf34acf84771ba4c3440000000000000000000000000000000000000000000006b823988244bf96e0000000000000000000000000000000000000000000000006b823988244bf96e000",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x1",
            "transactionLogIndex": "0x1"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x00000000000000000000000086d2fb177eff4be03a342951269096265b98ac4600000000000000000000000000000000000000000000006a5ded38ba0fc7800000000000000000000000000000000000000000000000006a5ded38ba0fc78000",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x2",
            "transactionLogIndex": "0x2"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000817cba144f54134e5fa664142ff11df3c74a1c760000000000000000000000000000000000000000000000000de096de94d2d0000000000000000000000000000000000000000000000000000de096de94d2d000",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x3",
            "transactionLogIndex": "0x3"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008ddae69c9f99522b11e31749c28e5f7cc89a19420000000000000000000000000000000000000000000006b7deb81845bd982acc0000000000000000000000000000000000000000000006b7deb81845bd982acc",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x4",
            "transactionLogIndex": "0x4"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008e2f2e68eb75bb8b18caafe9607242d4748f8d9800000000000000000000000000000000000000000000000005565a5b5edaa2cc00000000000000000000000000000000000000000000000005565a5b5edaa2cc",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x5",
            "transactionLogIndex": "0x5"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x00000000000000000000000087929dda85a959f52cab6083a2fba1b9973f15e00000000000000000000000000000000000000000000000000de2c6356d5c40000000000000000000000000000000000000000000000000000de2c6356d5c4000",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x6",
            "transactionLogIndex": "0x6"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000875e9cb14c3c55591e4db9b835d85efe9b13395b00000000000000000000000000000000000000000000000000c795237bde980000000000000000000000000000000000000000000000000000c795237bde9800",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x7",
            "transactionLogIndex": "0x7"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008d7df9316faa0586e175b5e6d03c6bda76e3d95000000000000000000000000000000000000000000000000002db8c846af26b9800000000000000000000000000000000000000000000000002db8c846af26b98",
            "blockHash": "0xf0375f56bd6fd2b5a470836644764e3eeaa9e5e3dc2efbc41316edf4003003f7",
            "epochNumber": "0x12dd1ec",
            "transactionHash": "0xd78742724603bf5ea32b8ecb5c2a212bc8a93e906bd9991136bf5f784cbb4d08",
            "transactionIndex": "0x0",
            "logIndex": "0x8",
            "transactionLogIndex": "0x8"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000817cba144f54134e5fa664142ff11df3c74a1c760000000000000000000000000000000000000000000000000de096de94d2d0000000000000000000000000000000000000000000000000000de06ae919a8cacc",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x0",
            "transactionLogIndex": "0x0"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008531b4bd1662b7ca943a3d27794203c7ace53e7200000000000000000000000000000000000000000000008368a98cc8902bb8000000000000000000000000000000000000000000000000836d1b8d5e50162acc",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x1",
            "transactionLogIndex": "0x1"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000821c636dfc85d0612fb8ebf34acf84771ba4c3440000000000000000000000000000000000000000000006b823988244bf96e0000000000000000000000000000000000000000000000006b8ba5c4d55be3d4000",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x2",
            "transactionLogIndex": "0x2"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x00000000000000000000000086d2fb177eff4be03a342951269096265b98ac4600000000000000000000000000000000000000000000006a5ded38ba0fc7800000000000000000000000000000000000000000000000006a772d6256309a4000",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x3",
            "transactionLogIndex": "0x3"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x000000000000000000000000875e9cb14c3c55591e4db9b835d85efe9b13395b00000000000000000000000000000000000000000000000000c795237bde980000000000000000000000000000000000000000000000000000c78d8f3a7f12cc",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x4",
            "transactionLogIndex": "0x4"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008d7df9316faa0586e175b5e6d03c6bda76e3d95000000000000000000000000000000000000000000000000002db8c846af26b9800000000000000000000000000000000000000000000000002da006eac25b334",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x5",
            "transactionLogIndex": "0x5"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008ddae69c9f99522b11e31749c28e5f7cc89a19420000000000000000000000000000000000000000000006b7deb81845bd982acc0000000000000000000000000000000000000000000006b7dd5abea072ae5598",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x6",
            "transactionLogIndex": "0x6"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x0000000000000000000000008e2f2e68eb75bb8b18caafe9607242d4748f8d9800000000000000000000000000000000000000000000000005565a5b5edaa2cc0000000000000000000000000000000000000000000000000558685917bfc800",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x7",
            "transactionLogIndex": "0x7"
        },
        {
            "address": "cfx:acc7uawf5ubtnmezvhu9dhc6sghea0403y2dgpyfjp",
            "topics": [
                "0x4d624906ce6fd4e4b8b649463516ff505029a1903a8cc34bd82b4ca0f9a479de"
            ],
            "data": "0x00000000000000000000000087929dda85a959f52cab6083a2fba1b9973f15e00000000000000000000000000000000000000000000000000de2c6356d5c40000000000000000000000000000000000000000000000000000de295b3caf8eacc",
            "blockHash": "0x3dbc0a1fc4d33800c455f094d1f02e72a5628a36bd050fbe4e6df5b60afed072",
            "epochNumber": "0x12dd1f1",
            "transactionHash": "0x16be20b90559993d9621b524170591356abb12c04fc4bc74a336253db0769717",
            "transactionIndex": "0x0",
            "logIndex": "0x8",
            "transactionLogIndex": "0x8"
        }
    ]
}
Language
URL
Click Try It! to start a request and see the response here!