starknet_estimateMessageFee
curl --request POST \
--url https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d \
--header 'Content-Type: application/json' \
--data '
{
"id": 0,
"jsonrpc": "2.0",
"method": "starknet_estimateMessageFee",
"params": [
{
"from_address": "0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419",
"to_address": "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82",
"entry_point_selector": "0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5",
"payload": [
"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604",
"0x6a94d74f430000",
"0x0"
]
},
{
"block_number": 387702
}
]
}
'import requests
url = "https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d"
payload = {
"id": 0,
"jsonrpc": "2.0",
"method": "starknet_estimateMessageFee",
"params": [{
"from_address": "0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419",
"to_address": "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82",
"entry_point_selector": "0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5",
"payload": ["0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604", "0x6a94d74f430000", "0x0"]
}, { "block_number": 387702 }]
}
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({
id: 0,
jsonrpc: '2.0',
method: 'starknet_estimateMessageFee',
params: [
{
from_address: '0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419',
to_address: '0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82',
entry_point_selector: '0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5',
payload: [
'0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604',
'0x6a94d74f430000',
'0x0'
]
},
{block_number: 387702}
]
})
};
fetch('https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d', 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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d",
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([
'id' => 0,
'jsonrpc' => '2.0',
'method' => 'starknet_estimateMessageFee',
'params' => [
[
'from_address' => '0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419',
'to_address' => '0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82',
'entry_point_selector' => '0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5',
'payload' => [
'0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604',
'0x6a94d74f430000',
'0x0'
]
],
[
'block_number' => 387702
]
]
]),
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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d"
payload := strings.NewReader("{\n \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d")
.header("Content-Type", "application/json")
.body("{\n \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d")
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 \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyStarknet node API
starknet_estimateMessageFee | Starknet
Starknet API method that returns the fee estimate for an L1 to L2 message sent from Ethereum. starknet_estimateMessageFee on Starknet via Chainstack.
POST
/
365cf697a3ad6d950b4c4a911e2e4f4d
starknet_estimateMessageFee
curl --request POST \
--url https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d \
--header 'Content-Type: application/json' \
--data '
{
"id": 0,
"jsonrpc": "2.0",
"method": "starknet_estimateMessageFee",
"params": [
{
"from_address": "0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419",
"to_address": "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82",
"entry_point_selector": "0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5",
"payload": [
"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604",
"0x6a94d74f430000",
"0x0"
]
},
{
"block_number": 387702
}
]
}
'import requests
url = "https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d"
payload = {
"id": 0,
"jsonrpc": "2.0",
"method": "starknet_estimateMessageFee",
"params": [{
"from_address": "0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419",
"to_address": "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82",
"entry_point_selector": "0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5",
"payload": ["0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604", "0x6a94d74f430000", "0x0"]
}, { "block_number": 387702 }]
}
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({
id: 0,
jsonrpc: '2.0',
method: 'starknet_estimateMessageFee',
params: [
{
from_address: '0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419',
to_address: '0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82',
entry_point_selector: '0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5',
payload: [
'0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604',
'0x6a94d74f430000',
'0x0'
]
},
{block_number: 387702}
]
})
};
fetch('https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d', 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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d",
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([
'id' => 0,
'jsonrpc' => '2.0',
'method' => 'starknet_estimateMessageFee',
'params' => [
[
'from_address' => '0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419',
'to_address' => '0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82',
'entry_point_selector' => '0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5',
'payload' => [
'0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604',
'0x6a94d74f430000',
'0x0'
]
],
[
'block_number' => 387702
]
]
]),
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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d"
payload := strings.NewReader("{\n \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\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://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d")
.header("Content-Type", "application/json")
.body("{\n \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://starknet-mainnet.core.chainstack.com/365cf697a3ad6d950b4c4a911e2e4f4d")
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 \"id\": 0,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_estimateMessageFee\",\n \"params\": [\n {\n \"from_address\": \"0xae0ee0a63a2ce6baeeffe56e7714fb4efe48d419\",\n \"to_address\": \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\",\n \"entry_point_selector\": \"0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5\",\n \"payload\": [\n \"0x1cf4ca56a4841f8a7d39d22d5369434f74e480b370be7bc5a814384b758e604\",\n \"0x6a94d74f430000\",\n \"0x0\"\n ]\n },\n {\n \"block_number\": 387702\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyStarknet OpenRPC specFor the latest version of the publicly maintained OpenRPC spec, see the Starknet specs GitHub repo.
l1_handler transaction that the message triggers on Starknet. You pay this fee on Ethereum when you send the message through the Starknet core contract. The returned overall_fee is at least 50,000,000,000,000 wei (0.00005 ETH).
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
message— the L1 to L2 message to estimate, with the following fields:from_address— the address of the Ethereum contract that sends the message.to_address— the address of the Starknet contract that receives the message.entry_point_selector— the selector of thel1_handlerfunction in the receiving contract.payload— the message payload as an array of field elements.
block_id— the hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on.
Response
result— the fee estimate, with the following fields. Numeric values are hexadecimal strings.l1_gas_consumed— the Ethereum gas the message consumes.l1_gas_price— the Ethereum gas price used in the estimate, in wei.l2_gas_consumed— the Starknet gas the message consumes.l2_gas_price— the Starknet gas price used in the estimate, in wei.l1_data_gas_consumed— the Ethereum data gas the message consumes.l1_data_gas_price— the Ethereum data gas price used in the estimate, in wei.overall_fee— the fee for the message, in wei. The value is at least 50,000,000,000,000 wei (0.00005 ETH). When the gas amounts multiplied by their prices add up to less than that,overall_feeis exactly 50,000,000,000,000 wei.unit— the fee unit, alwaysWEI.
Use case
A practical use case forstarknet_estimateMessageFee is to set the fee for a message that you send from Ethereum to Starknet. The message fee is the ETH value sent with the sendMessageToL2 call to the Starknet core contract, so pass the returned overall_fee as that value.
Deprecated feeder gateway method
The feeder gateway was deprecated on December 11, 2023. Example of the call you had to make to the feeder gateway before the deprecation:Shell
curl --request POST \
--url 'https://alpha-mainnet.starknet.io/feeder_gateway/estimate_fee?blockNumber=385940' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "INVOKE_FUNCTION",
"sender_address": "0x0569b13e8164bc8000c0bbcf4887856516643af123c5bc3b01e229e92f9cfd10",
"nonce": "0x51",
"max_fee": "0xb3a2f1ab6d632",
"version": "0x1",
"calldata": [
"0x3",
"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"0x219209e083275171774dab1df80982e9df2096516f06319c5c6d71ae0a8480c",
"0x3",
"0xfff107e2403123c7df78d91728a7ee5cfd557aec0fa2d2bdc5891c286bbfff",
"0x984e103a8acd6",
"0x0",
"0x68f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
"0x219209e083275171774dab1df80982e9df2096516f06319c5c6d71ae0a8480c",
"0x3",
"0xfff107e2403123c7df78d91728a7ee5cfd557aec0fa2d2bdc5891c286bbfff",
"0x4c4b40",
"0x0",
"0xfff107e2403123c7df78d91728a7ee5cfd557aec0fa2d2bdc5891c286bbfff",
"0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"0xe",
"0x569b13e8164bc8000c0bbcf4887856516643af123c5bc3b01e229e92f9cfd10",
"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"0x68f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
"0x1f4",
"0xa76cc",
"0xa7b5e",
"0x984e103a8acd6",
"0x0",
"0x4c4b40",
"0x0",
"0x9542431aa6bf1",
"0x0",
"0x4ac4a0",
"0x0"
],
"signature": ["0x54c2201c7b9021777389e208e28eafc67e4ba1f1aa7016a1123b61c6ff79c29", "0x58c2d97614e5abfd9668b314f344c945d16ea154cb32a7b08b4445204f1f1d3"]
}'
Last modified on October 8, 2026
Was this page helpful?