curl --request POST \
--url https://mainnet.mirrornode.hedera.com/api/v1/contracts/call \
--header 'Content-Type: application/json' \
--data '
{
"to": "0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6",
"block": "latest",
"data": "0x47f1aae7",
"estimate": true,
"from": "00000000000000000000000000000000000004e2",
"gas": 15000000,
"gasPrice": 100000000,
"value": 0
}
'import requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/contracts/call"
payload = {
"to": "0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6",
"block": "latest",
"data": "0x47f1aae7",
"estimate": True,
"from": "00000000000000000000000000000000000004e2",
"gas": 15000000,
"gasPrice": 100000000,
"value": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
to: '0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6',
block: 'latest',
data: '0x47f1aae7',
estimate: true,
from: '00000000000000000000000000000000000004e2',
gas: 15000000,
gasPrice: 100000000,
value: 0
})
};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/contracts/call', 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/call",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6',
'block' => 'latest',
'data' => '0x47f1aae7',
'estimate' => true,
'from' => '00000000000000000000000000000000000004e2',
'gas' => 15000000,
'gasPrice' => 100000000,
'value' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/contracts/call"
payload := strings.NewReader("{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.mirrornode.hedera.com/api/v1/contracts/call")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/contracts/call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}"
response = http.request(request)
puts response.read_body{
"result": "0x0000000000006d8d"
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}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. This API can process calls against the latest block or specific historical blocks when a hexadecimal or decimal block number is provided in the block field.
curl --request POST \
--url https://mainnet.mirrornode.hedera.com/api/v1/contracts/call \
--header 'Content-Type: application/json' \
--data '
{
"to": "0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6",
"block": "latest",
"data": "0x47f1aae7",
"estimate": true,
"from": "00000000000000000000000000000000000004e2",
"gas": 15000000,
"gasPrice": 100000000,
"value": 0
}
'import requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/contracts/call"
payload = {
"to": "0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6",
"block": "latest",
"data": "0x47f1aae7",
"estimate": True,
"from": "00000000000000000000000000000000000004e2",
"gas": 15000000,
"gasPrice": 100000000,
"value": 0
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
to: '0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6',
block: 'latest',
data: '0x47f1aae7',
estimate: true,
from: '00000000000000000000000000000000000004e2',
gas: 15000000,
gasPrice: 100000000,
value: 0
})
};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/contracts/call', 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/call",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6',
'block' => 'latest',
'data' => '0x47f1aae7',
'estimate' => true,
'from' => '00000000000000000000000000000000000004e2',
'gas' => 15000000,
'gasPrice' => 100000000,
'value' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.mirrornode.hedera.com/api/v1/contracts/call"
payload := strings.NewReader("{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.mirrornode.hedera.com/api/v1/contracts/call")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/contracts/call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"0xd9d0c5c0ff85758bdf05a7636f8036d4d065f5b6\",\n \"block\": \"latest\",\n \"data\": \"0x47f1aae7\",\n \"estimate\": true,\n \"from\": \"00000000000000000000000000000000000004e2\",\n \"gas\": 15000000,\n \"gasPrice\": 100000000,\n \"value\": 0\n}"
response = http.request(request)
puts response.read_body{
"result": "0x0000000000006d8d"
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}{
"_status": {
"messages": [
{
"data": "0x3000",
"detail": "Generic detailed error message",
"message": "Generic error message"
}
]
}
}Body
The 20-byte hexadecimal EVM address the transaction is directed to.
40 - 42^(0x)?[A-Fa-f0-9]{40}$Hexadecimal block number or the string "latest", "pending", "earliest". Defaults to "latest".
^((0x)?[0-9a-fA-F]+|(earliest|pending|latest))$"latest"
Hexadecimal method signature and encoded parameters. Up to 131072 bytes as at most 262146 hexadecimal digits including optional leading 0x.
262146^(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.
40 - 42^(0x)?[A-Fa-f0-9]{40}$Gas provided for the transaction execution. Defaults to 15000000.
x >= 015000000
Gas price used for each paid gas.
x >= 0100000000
Value sent with this transaction. Defaults to 0.
x >= 00
Response
OK
Result in hexadecimal from executed contract call.
^0x[0-9a-fA-F]+$Was this page helpful?