contracts

List contract logs from a contract on the network

Changed on

Search the logs of a specific contract across multiple contract calls. Chained logs are not included but can be found by calling /api/v1/contracts/{contractId}/results/{timestamp} or /api/v1/contracts/results/{transactionId}. When searching by topic a timestamp parameter must be supplied and span a time range of at most seven days.

Ordering

The order is governed by the combination of timestamp and index values. If the index param is omitted, the order is determined by the timestamp only.

Note: The default order for this API is currently DESC

Filtering

When filtering there are some restrictions enforced to ensure correctness and scalability.

The table below defines the restrictions and support for the endpoint

Query ParamComparison OperatorSupportDescriptionExample
indexeqYSingle occurrence only. Requires the presence of timestamp?index=X
neN
lt(e)YSingle occurrence only. Requires the presence of timestamp?index=lte:X
gt(e)YSingle occurrence only. Requires the presence of timestamp?index=gte:X
timestampeqYSingle occurrence only.?timestamp=Y
neN
lt(e)YSingle occurrence only. Optional second timestamp gt(e)?timestamp=lte:Y
gt(e)YSingle occurrence only. Optional second timestamp lt(e)?timestamp=gte:Y

Both filters must be a single occurrence of gt(e) or lt(e) which provide a lower and or upper boundary for search.

get/api/v1/contracts/{contractIdOrAddress}/results/logs

Request

  • Base URL
    (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /api/v1/contracts/{contractIdOrAddress}/results/logs
  • Auth
    none declared

Path parameters

contractIdOrAddressstring required

Contract or account identifier in format shard.realm.num, realm.num, num or a 20-byte EVM address (with or without 0x prefix).

Query parameters

indexstring

Contract log index

limitinteger

The maximum number of items to return

order'asc' | 'desc'

The order in which items are listed

timestampstring[]

The consensus timestamp as a Unix timestamp in seconds.nanoseconds format with an optional comparison operator. See unixtimestamp.com for a simple way to convert a date to the 'seconds' part of the Unix time.

topic0string[]

The first topic associated with a contract log. Requires a timestamp range also be populated.

topic1string[]

The second topic associated with a contract log. Requires a timestamp range also be populated.

topic2string[]

The third topic associated with a contract log. Requires a timestamp range also be populated.

topic3string[]

The fourth topic associated with a contract log. Requires a timestamp range also be populated.

Response

OK

Example response

{
  "logs": [
    {
      "address": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "bloom": "0x549358c4c2e573e02410ef7b5a5ffa5f36dd7398",
      "contract_id": "0.0.2",
      "data": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "topics": [
        "0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300"
      ],
      "block_hash": "0x553f9311833391c0a3b2f9ed64540a89f2190a511986cd94889f1c0cf7fa63e898b1c6730f14a61755d1fb4ca05fb073",
      "block_number": 10,
      "root_contract_id": "0.0.2",
      "timestamp": "1586567700.453054000",
      "transaction_hash": "0x397022d1e5baeb89d0ab66e6bf602640610e6fb7e55d78638db861e2c6339aa9",
      "transaction_index": 1
    }
  ]
}

Changes