Smart Contracts

Overview

The Smart Contracts endpoints in the Hedera Mirror Node REST API allows developers to query smart contract metadata, execution results, state changes, and logs. These endpoints are essential for tracking contract interactions, retrieving transaction results, and debugging contract executions on the Hedera network.

Endpoints

The following endpoints are available for the Smart Contracts object:

Endpoint

Description

GET /api/v1/contracts

Retrieves a list of smart contract entities on the network.

GET /api/v1/contracts/{id}

Fetches details of a specific contract by ID.

GET /api/v1/contracts/{id}/results

Retrieves execution results for a specific contract.

GET /api/v1/contracts/{id}/state

Fetches the latest state of a contract.

GET /api/v1/contracts/results

Lists execution results for all contracts.

GET /api/v1/contracts/results/{timestamp}

Retrieves execution results for a contract at a given timestamp.

GET /api/v1/contracts/logs

Lists logs emitted from contracts.

GET /api/v1/contracts/logs/{id}

Fetches logs for a specific contract.

POST /api/v1/contracts/call

Invokes a smart contract method.

Smart Contracts

List contract entities on network

Returns a list of all contract entity items on the network.

get

/api/v1/contracts

Query parameters
contract.idstring

The ID of the smart contract

Pattern: ^((gte?|lte?|eq|ne)\:)?(\d{1,10}\.\d{1,10}\.)?\d{1,10}|(\d{1,10}\.){0,2}[A-Fa-f0-9]{40}$
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: asc
Options: asc, desc
Responses
curl -L \
  --url '/api/v1/contracts'
{
  "contracts": [
    {
      "admin_key": {
        "key": "15706b229b3ba33d4a5a41ff54ce1cfe0a3d308672a33ff382f81583e02bd743",
        "_type": "ProtobufEncoded"
      },
      "auto_renew_account": "0.0.2",
      "auto_renew_period": 7776000,
      "contract_id": "0.0.2",
      "created_timestamp": "1586567700.453054000",
      "deleted": false,
      "evm_address": "0000000000000000000000000000000000001f41",
      "expiration_timestamp": "1586567700.453054000",
      "file_id": "0.0.2",
      "max_automatic_token_associations": 1,
      "memo": "contract memo",
      "obtainer_id": "0.0.2",
      "permanent_removal": true,
      "proxy_account_id": "0.0.2",
      "timestamp": {
        "from": null,
        "to": null
      }
    }
  ],
  "links": {
    "next": null
  }
}
Response Item
Description

admin_key

The admin key of the contract, if specified

auto_renew_account

The account paying the auto renew fees, if set

auto_renew_period

The period at which the contract auto renews

bytecode

The bytecode of the contract

contract_id

The contract ID

created_timestamp

The timestamp the contract was created at

deleted

Whether or not the contract is deleted

evm_address

The EVM address of the contract

expiration_timestamp

The timestamp of when the contract is set to expire

file_id

The ID of the file that stored the contract bytecode

max_automatic_token_associations

The number of automatic token association slots

memo

The memo of the contract, if specified

obtainer_id

The ID of the account or contract that will receive any remaining balance when the contract is deleted

permanent_removal

Set to true when the system expires a contract

proxy_account_id

The proxy account ID (disabled)

solidity_address

The solidity address

timestamp

The period for which the attributes are valid for

Get contract by id

Return the contract information given an id

get

/api/v1/contracts/{contractIdOrAddress}

Path parameters
contractIdOrAddressstringrequired

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
Query parameters
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.

Responses
curl -L \
  --url '/api/v1/contracts/{contractIdOrAddress}'
{
  "admin_key": {
    "key": "15706b229b3ba33d4a5a41ff54ce1cfe0a3d308672a33ff382f81583e02bd743",
    "_type": "ProtobufEncoded"
  },
  "auto_renew_account": "0.0.2",
  "auto_renew_period": 7776000,
  "contract_id": "0.0.2",
  "created_timestamp": "1586567700.453054000",
  "deleted": false,
  "evm_address": "0000000000000000000000000000000000001f41",
  "expiration_timestamp": "1586567700.453054000",
  "file_id": "0.0.2",
  "max_automatic_token_associations": 1,
  "memo": "contract memo",
  "obtainer_id": "0.0.2",
  "permanent_removal": true,
  "proxy_account_id": "0.0.2",
  "timestamp": {
    "from": null,
    "to": null
  },
  "bytecode": "0x01021a1fdc9b",
  "runtime_bytecode": "0x0302fa1ad39c"
}

List contract results from a contract on the network

Returns a list of all ContractResults for a contract's function executions.

get

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

Path parameters
contractIdOrAddressstringrequired

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
Query parameters
block.hashstring

The block's hash. If multiple values are provided the last value will be the only value used.

Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
block.numberstring

The block's number

Pattern: ^(eq:)?(\d{1,19}|0x[a-fA-f0-9]+)$
fromstring

Account ID or EVM address executing the contract

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}|(0x)?[A-Fa-f0-9]{40}$
internalboolean

Whether to include child transactions or not

Example: true
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: asc
Options: asc, desc
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.

transaction.indexinteger int32

The transaction index in the block

Example: 1
Responses
curl -L \
  --url '/api/v1/contracts/{contractIdOrAddress}/results'
{
  "results": [
    {
      "contract_id": "0.0.2",
      "from": "0x0000000000000000000000000000000000001f41",
      "timestamp": "1586567700.453054000",
      "to": "0x0000000000000000000000000000000000001f41",
      "block_hash": "0x6ceecd8bb224da491",
      "block_number": 10,
      "transaction_index": 1,
      "access_list": "0xabcd",
      "address": "0x25fe26adc577cc89172e6156c9e24f7b9751b762",
      "amount": 10,
      "block_gas_used": 2000,
      "call_result": "0x2b048531b38d2882e86044bc972e940ee0a01938",
      "chain_id": "0x0127",
      "error_message": "Out of gas",
      "failed_initcode": "0x856739",
      "function_parameters": "0xbb9f02dc6f0e3289f57a1f33b71c73aa8548ab8b",
      "gas_consumed": 35000,
      "gas_limit": 100000,
      "gas_price": "0x4a817c800",
      "gas_used": 80000,
      "hash": "0xfebbaa29c513d124a6377246ea3506ad917d740c21a88f61a1c55ba338fc2bb1",
      "max_fee_per_gas": "0x5",
      "max_priority_fee_per_gas": "0x100",
      "nonce": 1,
      "r": "0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c043",
      "result": "SUCCESS",
      "s": "0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b355",
      "status": 1,
      "type": 2,
      "v": 1,
      "created_contract_ids": [
        "0.0.2"
      ],
      "bloom": null
    }
  ],
  "links": {
    "next": null
  }
}

The contract state from a contract on the network

Returns a list of all contract's slots. If no timestamp is provided, returns the current state.

get

/api/v1/contracts/{contractIdOrAddress}/state

Path parameters
contractIdOrAddressstringrequired

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
Query parameters
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: desc
Options: asc, desc
slotstring

The slot's number

Pattern: ^((eq|gte?|lte?)\:)?(0x)?[0-9A-Fa-f]{1,64}$
timestampstring[]

The consensus timestamp of the contract state 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.

Responses
curl -L \
  --url '/api/v1/contracts/{contractIdOrAddress}/state'
{
  "links": {
    "next": null
  },
  "state": [
    {
      "address": "0000000000000000000000000000000000001f41",
      "contract_id": "0.0.2",
      "timestamp": "1586567700.453054000",
      "slot": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "value": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
    }
  ]
}

Get the contract result from a contract on the network executed at a given timestamp

Returns a single ContractResult for a contract's function executions at a specific timestamp.

get

/api/v1/contracts/{contractIdOrAddress}/results/{timestamp}

Path parameters
contractIdOrAddressstringrequired

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
timestampstringrequired

The Unix timestamp in seconds.nanoseconds format, the timestamp at which the associated transaction reached consensus. See unixtimestamp.com for a simple way to convert a date to the 'seconds' part of the Unix time.

Example: 1234567890.0000007
Pattern: ^\d{1,10}(.\d{1,9})?$
Responses
curl -L \
  --url '/api/v1/contracts/{contractIdOrAddress}/results/{timestamp}'
{
  "contract_id": "0.0.2",
  "from": "0x0000000000000000000000000000000000001f41",
  "timestamp": "1586567700.453054000",
  "to": "0x0000000000000000000000000000000000001f41",
  "block_hash": "0x6ceecd8bb224da491",
  "block_number": 10,
  "transaction_index": 1,
  "access_list": "0xabcd",
  "address": "0x25fe26adc577cc89172e6156c9e24f7b9751b762",
  "amount": 10,
  "block_gas_used": 2000,
  "call_result": "0x2b048531b38d2882e86044bc972e940ee0a01938",
  "chain_id": "0x0127",
  "error_message": "Out of gas",
  "failed_initcode": "0x856739",
  "function_parameters": "0xbb9f02dc6f0e3289f57a1f33b71c73aa8548ab8b",
  "gas_consumed": 35000,
  "gas_limit": 100000,
  "gas_price": "0x4a817c800",
  "gas_used": 80000,
  "hash": "0x3531396130303866616264653464",
  "max_fee_per_gas": "0x5",
  "max_priority_fee_per_gas": "0x100",
  "nonce": 1,
  "r": "0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c043",
  "result": "SUCCESS",
  "s": "0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b355",
  "status": 1,
  "type": 2,
  "v": 1,
  "created_contract_ids": [
    "0.0.2"
  ],
  "bloom": null,
  "logs": [
    {
      "contract_id": "0.0.2",
      "topics": [
        "0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300"
      ],
      "address": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "data": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "index": 0,
      "bloom": null
    }
  ],
  "state_changes": [
    {
      "address": "0000000000000000000000000000000000001f41",
      "contract_id": "0.0.2",
      "slot": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "value_read": "0x97c1fc0a6ed5551bc831571325e9bdb365d06803100dc20648640ba24ce69750",
      "value_written": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
    }
  ]
}

List contract results from all contracts on the network

Returns a list of all ContractResults for all contract's function executions.

get

/api/v1/contracts/results

Query parameters
fromstring

Account ID or EVM address executing the contract

Pattern: ^\d{1,10}\.\d{1,10}\.\d{1,10}|(0x)?[A-Fa-f0-9]{40}$
block.hashstring

The block's hash. If multiple values are provided the last value will be the only value used.

Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
block.numberstring

The block's number

Pattern: ^(eq:)?(\d{1,19}|0x[a-fA-f0-9]+)$
internalboolean

Whether to include child transactions or not

Example: true
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: asc
Options: asc, desc
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.

transaction.indexinteger int32

The transaction index in the block

Example: 1
Responses
curl -L \
  --url '/api/v1/contracts/results'
{
  "results": [
    {
      "contract_id": "0.0.2",
      "from": "0x0000000000000000000000000000000000001f41",
      "timestamp": "1586567700.453054000",
      "to": "0x0000000000000000000000000000000000001f41",
      "block_hash": "0x6ceecd8bb224da491",
      "block_number": 10,
      "transaction_index": 1,
      "access_list": "0xabcd",
      "address": "0x25fe26adc577cc89172e6156c9e24f7b9751b762",
      "amount": 10,
      "block_gas_used": 2000,
      "call_result": "0x2b048531b38d2882e86044bc972e940ee0a01938",
      "chain_id": "0x0127",
      "error_message": "Out of gas",
      "failed_initcode": "0x856739",
      "function_parameters": "0xbb9f02dc6f0e3289f57a1f33b71c73aa8548ab8b",
      "gas_consumed": 35000,
      "gas_limit": 100000,
      "gas_price": "0x4a817c800",
      "gas_used": 80000,
      "hash": "0xfebbaa29c513d124a6377246ea3506ad917d740c21a88f61a1c55ba338fc2bb1",
      "max_fee_per_gas": "0x5",
      "max_priority_fee_per_gas": "0x100",
      "nonce": 1,
      "r": "0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c043",
      "result": "SUCCESS",
      "s": "0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b355",
      "status": 1,
      "type": 2,
      "v": 1,
      "created_contract_ids": [
        "0.0.2"
      ],
      "bloom": null
    }
  ],
  "links": {
    "next": null
  }
}

Get the contract result from a contract on the network for a given transactionId or ethereum transaction hash

Returns a single ContractResult for a contract's function executions for a given transactionId or ethereum transaction hash.

get

/api/v1/contracts/results/{transactionIdOrHash}

Path parameters
transactionIdOrHashstringrequired

Transaction Id or a 32 byte hash with optional 0x prefix

Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
Query parameters
nonceinteger int32

Filter the query result by the nonce of the transaction. A zero nonce represents user submitted transactions while a non-zero nonce is generated by main nodes. The filter honors the last value. Default is 0 when not specified.

Example: 1
Responses
curl -L \
  --url '/api/v1/contracts/results/{transactionIdOrHash}'
{
  "contract_id": "0.0.2",
  "from": "0x0000000000000000000000000000000000001f41",
  "timestamp": "1586567700.453054000",
  "to": "0x0000000000000000000000000000000000001f41",
  "block_hash": "0x6ceecd8bb224da491",
  "block_number": 10,
  "transaction_index": 1,
  "access_list": "0xabcd",
  "address": "0x25fe26adc577cc89172e6156c9e24f7b9751b762",
  "amount": 10,
  "block_gas_used": 2000,
  "call_result": "0x2b048531b38d2882e86044bc972e940ee0a01938",
  "chain_id": "0x0127",
  "error_message": "Out of gas",
  "failed_initcode": "0x856739",
  "function_parameters": "0xbb9f02dc6f0e3289f57a1f33b71c73aa8548ab8b",
  "gas_consumed": 35000,
  "gas_limit": 100000,
  "gas_price": "0x4a817c800",
  "gas_used": 80000,
  "hash": "0x3531396130303866616264653464",
  "max_fee_per_gas": "0x5",
  "max_priority_fee_per_gas": "0x100",
  "nonce": 1,
  "r": "0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c043",
  "result": "SUCCESS",
  "s": "0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b355",
  "status": 1,
  "type": 2,
  "v": 1,
  "created_contract_ids": [
    "0.0.2"
  ],
  "bloom": null,
  "logs": [
    {
      "contract_id": "0.0.2",
      "topics": [
        "0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300"
      ],
      "address": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "data": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "index": 0,
      "bloom": null
    }
  ],
  "state_changes": [
    {
      "address": "0000000000000000000000000000000000001f41",
      "contract_id": "0.0.2",
      "slot": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "value_read": "0x97c1fc0a6ed5551bc831571325e9bdb365d06803100dc20648640ba24ce69750",
      "value_written": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
    }
  ]
}

Get the contract actions from a contract on the network for a given transactionId or ethereum transaction hash

Returns a list of ContractActions for a contract's function executions for a given transactionId or ethereum transaction hash.

get

/api/v1/contracts/results/{transactionIdOrHash}/actions

Path parameters
transactionIdOrHashstringrequired

Transaction Id or a 32 byte hash with optional 0x prefix

Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
Query parameters
indexstring

The index of a contract action

Pattern: ^((gte?|lte?|eq|ne)\:)?\d{1,10}$
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: desc
Options: asc, desc
Responses
curl -L \
  --url '/api/v1/contracts/results/{transactionIdOrHash}/actions'
{
  "actions": [
    {
      "caller": "0.0.2",
      "recipient": "0.0.2",
      "timestamp": "1586567700.453054000",
      "to": "0x0000000000000000000000000000000000001f41",
      "call_depth": 1,
      "from": "0x0000000000000000000000000000000000000065",
      "gas": 50000,
      "gas_used": 50000,
      "index": 0,
      "input": "0x123456",
      "result_data": "0x123456",
      "value": 50000,
      "call_operation_type": "CALL",
      "call_type": "CALL",
      "caller_type": "ACCOUNT",
      "recipient_type": "ACCOUNT",
      "result_data_type": "OUTPUT"
    }
  ],
  "links": {
    "next": null
  }
}

Get the opcode traces for a historical transaction on the network with the given transaction ID or hash

Re-executes a transaction and returns a result containing detailed information for the execution, including all values from the {@code stack}, {@code memory} and {@code storage} and the entire trace of opcodes that were executed during the replay.

Note that to provide the output, the transaction needs to be re-executed on the EVM, which may take a significant amount of time to complete if stack and memory information is requested.

get

/api/v1/contracts/results/{transactionIdOrHash}/opcodes

Path parameters
transactionIdOrHashstringrequired

Transaction Id or a 32 byte hash with optional 0x prefix

Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
Query parameters
stackboolean

If provided and set to false, stack information will not be included in the response

Example: true
memoryboolean

If provided and set to true, memory information will be included in the response

Example: false
storageboolean

If provided and set to true, storage information will be included in the response

Example: false
Responses
curl -L \
  --url '/api/v1/contracts/results/{transactionIdOrHash}/opcodes'
{
  "contract_id": "0.0.2",
  "address": "text",
  "failed": true,
  "gas": 1,
  "return_value": "text",
  "opcodes": [
    {
      "depth": 1,
      "gas": 1,
      "gas_cost": 1,
      "op": "text",
      "pc": 1,
      "reason": "text",
      "memory": [
        "text"
      ],
      "stack": [
        "text"
      ],
      "storage": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      }
    }
  ]
}

List contract logs from a contract on the network

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 Param Comparison Operator Support Description Example
index eq Y Single occurrence only. Requires the presence of timestamp ?index=X
ne N
lt(e) Y Single occurrence only. Requires the presence of timestamp ?index=lte:X
gt(e) Y Single occurrence only. Requires the presence of timestamp ?index=gte:X
timestamp eq Y Single occurrence only. ?timestamp=Y
ne N
lt(e) Y Single occurrence only. Optional second timestamp gt(e) ?timestamp=lte:Y
gt(e) Y Single 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

Path parameters
contractIdOrAddressstringrequired

The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.

Pattern: ^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
Query parameters
indexstring

Contract log index

Pattern: ^((eq|gt|gte|lt|lte):)?\d{1,10}$
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: asc
Options: asc, desc
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.

Responses
curl -L \
  --url '/api/v1/contracts/{contractIdOrAddress}/results/logs'
{
  "logs": [
    {
      "contract_id": "0.0.2",
      "topics": [
        "0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300"
      ],
      "address": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "data": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "index": 0,
      "bloom": null,
      "timestamp": "1586567700.453054000",
      "block_hash": "0x553f9311833391c0a3b2f9ed64540a89f2190a511986cd94889f1c0cf7fa63e898b1c6730f14a61755d1fb4ca05fb073",
      "block_number": 10,
      "transaction_hash": "0x397022d1e5baeb89d0ab66e6bf602640610e6fb7e55d78638db861e2c6339aa9",
      "transaction_index": 1,
      "root_contract_id": null
    }
  ],
  "links": {
    "next": null
  }
}

List contracts logs across many contracts on the network

Search the logs across many contracts with 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 Param Comparison Operator Support Description Example
index eq Y Single occurrence only. Requires the presence of timestamp ?index=X
ne N
lt(e) Y Single occurrence only. Requires the presence of timestamp ?index=lte:X
gt(e) Y Single occurrence only. Requires the presence of timestamp ?index=gte:X
timestamp eq Y Single occurrence only. ?timestamp=Y
ne N
lt(e) Y Single occurrence only. Optional second timestamp gt(e) ?timestamp=lte:Y
gt(e) Y Single 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/results/logs

Query parameters
indexstring

Contract log index

Pattern: ^((eq|gt|gte|lt|lte):)?\d{1,10}$
limitinteger int32

The maximum number of items to return

Example: 2
orderenum

The order in which items are listed

Example: asc
Options: asc, desc
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.

transaction.hashstring

A hex encoded 32-byte ethereum transaction hash or 48-byte hedera transaction hash.

Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
Responses
curl -L \
  --url '/api/v1/contracts/results/logs'
{
  "logs": [
    {
      "contract_id": "0.0.2",
      "topics": [
        "0xf4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad300"
      ],
      "address": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "data": "0x00000000000000000000000000000000000000000000000000000000000000fa",
      "index": 0,
      "bloom": null,
      "timestamp": "1586567700.453054000",
      "block_hash": "0x553f9311833391c0a3b2f9ed64540a89f2190a511986cd94889f1c0cf7fa63e898b1c6730f14a61755d1fb4ca05fb073",
      "block_number": 10,
      "transaction_hash": "0x397022d1e5baeb89d0ab66e6bf602640610e6fb7e55d78638db861e2c6339aa9",
      "transaction_index": 1,
      "root_contract_id": null
    }
  ],
  "links": {
    "next": null
  }
}

Invoke a smart contract

Returns a result from EVM execution such as cost-free execution of read-only smart contract queries, gas estimation, and transient simulation of read-write operations. If the estimate field is set to true gas estimation is executed. However, gas estimation only supports the latest block. When estimate is false, it can process calls against the earliest block and specific historical blocks when a hexadecimal or decimal block number is provided in the block field for eth_call operations. Link to Supported/Unsupported Operations Table The operations types which are not currently supported should return 501 error status.

post

/api/v1/contracts/call

Body
blocknullable string

Hexadecimal block number or the string "latest", "pending", "earliest". Defaults to "latest".

Example: latest
Pattern: ^((0x)?[0-9a-fA-F]+|(earliest|pending|latest))$
datanullable string binary

Hexadecimal method signature and encoded parameters. Up to 24656 bytes as at most 49152 hexidecimal digits plus optional leading 0x.

Example: 0x47f1aae7
Pattern: ^(0x)?[0-9a-fA-F]+$
estimatenullable boolean

Whether gas estimation is called. Defaults to false.

Example: true
fromnullable string binary

The 20-byte hexadecimal EVM address the transaction is sent from.

Example: 00000000000000000000000000000000000004e2
Pattern: ^(0x)?[A-Fa-f0-9]{40}$
gasnullable integer int64

Gas provided for the transaction execution. Defaults to 15000000.

Example: 15000000
gasPricenullable integer int64

Gas price used for each paid gas.

Example: 100000000
tostring binaryrequired

The 20-byte hexadecimal EVM address the transaction is directed to.

Example: 0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6
Pattern: ^(0x)?[A-Fa-f0-9]{40}$
valuenullable integer int64

Value sent with this transaction. Defaults to 0.

Example: 0
Responses
curl -L \
  --request POST \
  --url '/api/v1/contracts/call' \
  --header 'Content-Type: application/json' \
  --data '{"block":"latest","data":"0x47f1aae7","estimate":true,"from":"00000000000000000000000000000000000004e2","gas":15000000,"gasPrice":100000000,"to":"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6","value":0}'
{
  "result": "0x0000000000006d8d"
}

Last updated

Was this helpful?