curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}import requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"admin_key": {
"_type": "ProtobufEncoded",
"key": "15706b229b3ba33d4a5a41ff54ce1cfe0a3d308672a33ff382f81583e02bd743"
},
"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": 123,
"memo": "contract memo",
"nonce": 1,
"obtainer_id": "0.0.2",
"permanent_removal": true,
"proxy_account_id": "0.0.2",
"timestamp": {
"from": "1586567700.453054000",
"to": "1586567700.453054000"
},
"bytecode": "0x01021a1fdc9b",
"runtime_bytecode": "0x0302fa1ad39c"
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}Get contract by id
Return the contract information given an id
curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}import requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/contracts/{contractIdOrAddress}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"admin_key": {
"_type": "ProtobufEncoded",
"key": "15706b229b3ba33d4a5a41ff54ce1cfe0a3d308672a33ff382f81583e02bd743"
},
"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": 123,
"memo": "contract memo",
"nonce": 1,
"obtainer_id": "0.0.2",
"permanent_removal": true,
"proxy_account_id": "0.0.2",
"timestamp": {
"from": "1586567700.453054000",
"to": "1586567700.453054000"
},
"bytecode": "0x01021a1fdc9b",
"runtime_bytecode": "0x0302fa1ad39c"
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}Path Parameters
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})$Query Parameters
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.
^((eq|gt|gte|lt|lte|ne):)?\d{1,10}(\.\d{1,9})?$Response
OK
The public key which controls access to various network entities.
Show child attributes
Show child attributes
Network entity ID in the format of shard.realm.num
^\d{1,10}\.\d{1,10}\.\d{1,10}$"0.0.2"
7776000
Network entity ID in the format of shard.realm.num
^\d{1,10}\.\d{1,10}\.\d{1,10}$"0.0.2"
A Unix timestamp in seconds.nanoseconds format
^\d{1,10}(\.\d{1,9})?$"1586567700.453054000"
false
A network entity encoded as an EVM address in hex.
40 - 42^(0x)?[A-Fa-f0-9]{40}$A Unix timestamp in seconds.nanoseconds format
^\d{1,10}(\.\d{1,9})?$"1586567700.453054000"
Network entity ID in the format of shard.realm.num
^\d{1,10}\.\d{1,10}\.\d{1,10}$"0.0.2"
"contract memo"
The nonce of the contract
1
Network entity ID in the format of shard.realm.num
^\d{1,10}\.\d{1,10}\.\d{1,10}$"0.0.2"
Network entity ID in the format of shard.realm.num
^\d{1,10}\.\d{1,10}\.\d{1,10}$"0.0.2"
A timestamp range an entity is valid for
Show child attributes
Show child attributes
The contract bytecode in hex during deployment
The contract bytecode in hex after deployment
Was this page helpful?