Last updated
Was this helpful?
Last updated
Was this helpful?
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.
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/{contractIdOrAddress}
Fetches details of a specific contract by ID.
GET /api/v1/contracts/results/{transactionIdOrhash}
Retrieves execution results for a specific contract transaction ID.
GET /api/v1/contracts/{contractIdOrAddress}/results
Retrieves execution results for a specific contract.
GET /api/v1/contracts/{id}/state
Fetches the state of a contract.
GET /api/v1/contracts/results
Lists execution results for all contracts.
GET /api/v1/contracts/results/{transactionIdOrHash}/results
Get contract actions by transaction ID or transaction hash.
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/{id}/results/logs
Fetches logs for a specific contract.
GET /api/v1/contracts/{id}/results/opcodes
Get the opcode traces for historical transactions
POST /api/v1/contracts/call
Invokes a smart contract method.
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
Returns a list of all contract entity items on the network.
The ID of the smart contract
{"summary":"--","value":""}
Pattern: ^((gte?|lte?|eq|ne)\:)?(\d{1,10}\.\d{1,10}\.)?\d{1,10}|(\d{1,10}\.){0,2}[A-Fa-f0-9]{40}$
The maximum number of items to return
25
Example: 2
The order in which items are listed
desc
Example: asc
Possible values: Return the contract information given an id
The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.
^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
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.
{"summary":"--","value":""}
Returns a single ContractResult for a contract's function executions for a given transactionId or ethereum transaction hash.
Transaction Id or a 32 byte hash with optional 0x prefix
{"value":"0.0.10-1234567890-000000000"}
Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
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.
0
Example: 1
Returns a list of all ContractResults for a contract's function executions.
The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.
^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
The block's hash. If multiple values are provided the last value will be the only value used.
{"summary":"--","value":""}
Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
The block's number
{"summary":"--","value":""}
Pattern: ^(eq:)?(\d{1,19}|0x[a-fA-f0-9]+)$
Account ID or EVM address executing the contract
^\d{1,10}\.\d{1,10}\.\d{1,10}|(0x)?[A-Fa-f0-9]{40}$
Whether to include child transactions or not
false
Example: true
The maximum number of items to return
25
Example: 2
The order in which items are listed
desc
Example: asc
Possible values: 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.
{"summary":"--","value":""}
The transaction index in the block
1
Returns a list of all contract's slots. If no timestamp is provided, returns the current state.
The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.
^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
The maximum number of items to return
25
Example: 2
The order in which items are listed
asc
Example: desc
Possible values: The slot's number
{"summary":"--","value":""}
Pattern: ^((eq|gte?|lte?)\:)?(0x)?[0-9A-Fa-f]{1,64}$
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.
{"summary":"--","value":""}
Returns a list of all ContractResults for all contract's function executions.
Account ID or EVM address executing the contract
^\d{1,10}\.\d{1,10}\.\d{1,10}|(0x)?[A-Fa-f0-9]{40}$
The block's hash. If multiple values are provided the last value will be the only value used.
{"summary":"--","value":""}
Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
The block's number
{"summary":"--","value":""}
Pattern: ^(eq:)?(\d{1,19}|0x[a-fA-f0-9]+)$
Whether to include child transactions or not
false
Example: true
The maximum number of items to return
25
Example: 2
The order in which items are listed
desc
Example: asc
Possible values: 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.
{"summary":"--","value":""}
The transaction index in the block
1
Returns a list of ContractActions for a contract's function executions for a given transactionId or ethereum transaction hash.
Transaction Id or a 32 byte hash with optional 0x prefix
{"value":"0.0.10-1234567890-000000000"}
Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
The index of a contract action
{"summary":"--","value":""}
Pattern: ^((gte?|lte?|eq|ne)\:)?\d{1,10}$
The maximum number of items to return
25
Example: 2
The order in which items are listed
asc
Example: desc
Possible values: Returns a single ContractResult for a contract's function executions at a specific timestamp.
The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.
^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
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.
1234567890.0000007
Pattern: ^\d{1,10}(.\d{1,9})?$
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.
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
When filtering there are some restrictions enforced to ensure correctness and scalability.
The table below defines the restrictions and support for the endpoint
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.
The ID or hex encoded EVM address (with or without 0x prefix) associated with this contract.
^(\d{1,10}\.){0,2}(\d{1,10}|(0x)?[A-Fa-f0-9]{40})$
Contract log index
{"summary":"--","value":""}
Pattern: ^((eq|gt|gte|lt|lte):)?\d{1,10}$
The maximum number of items to return
25
Example: 2
The order in which items are listed
desc
Example: asc
Possible values: 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.
{"summary":"--","value":""}
The first topic associated with a contract log. Requires a timestamp range also be populated.
The second topic associated with a contract log. Requires a timestamp range also be populated.
The third topic associated with a contract log. Requires a timestamp range also be populated.
The fourth topic associated with a contract log. Requires a timestamp range also be populated.
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.
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
When filtering there are some restrictions enforced to ensure correctness and scalability.
The table below defines the restrictions and support for the endpoint
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.
Contract log index
{"summary":"--","value":""}
Pattern: ^((eq|gt|gte|lt|lte):)?\d{1,10}$
The maximum number of items to return
25
Example: 2
The order in which items are listed
desc
Example: asc
Possible values: 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.
{"summary":"--","value":""}
The first topic associated with a contract log. Requires a timestamp range also be populated.
The second topic associated with a contract log. Requires a timestamp range also be populated.
The third topic associated with a contract log. Requires a timestamp range also be populated.
The fourth topic associated with a contract log. Requires a timestamp range also be populated.
A hex encoded 32-byte ethereum transaction hash or 48-byte hedera transaction hash.
{"value":"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"}
Pattern: ^(eq:)?(0x)?([0-9A-Fa-f]{64}|[0-9A-Fa-f]{96})$
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.
Transaction Id or a 32 byte hash with optional 0x prefix
{"value":"0.0.10-1234567890-000000000"}
Pattern: ^(0x)?[A-Fa-f0-9]{64}|(\d{1,10})\.(\d{1,10})\.(\d{1,10})-(\d{1,19})-(\d{1,9})$
If provided and set to false, stack information will not be included in the response
true
Example: true
If provided and set to true, memory information will be included in the response
false
Example: false
If provided and set to true, storage information will be included in the response
false
Example: false
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.
The operations types which are not currently supported should return 501 error status.
Hexadecimal block number or the string "latest", "pending", "earliest". Defaults to "latest".
latest
Pattern: ^((0x)?[0-9a-fA-F]+|(earliest|pending|latest))$
Hexadecimal method signature and encoded parameters. Up to 24656 bytes as at most 49152 hexidecimal digits plus optional leading 0x.
0x47f1aae7
Pattern: ^(0x)?[0-9a-fA-F]+$
Whether gas estimation is called. Defaults to false.
true
The 20-byte hexadecimal EVM address the transaction is sent from.
00000000000000000000000000000000000004e2
Pattern: ^(0x)?[A-Fa-f0-9]{40}$
Gas provided for the transaction execution. Defaults to 15000000.
15000000
Gas price used for each paid gas.
100000000
The 20-byte hexadecimal EVM address the transaction is directed to.
0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6
Pattern: ^(0x)?[A-Fa-f0-9]{40}$
Value sent with this transaction. Defaults to 0.
0