Skip to main content

starknet_estimateMessageFee RPC Method

Estimates the resources required by the l1_handler transaction induced by the message.

Updated on
Mar 18, 2024

starknet_estimateMessageFee RPC Method

Parameters

MSG_FROM_L1
object
REQUIRED
The Message from L1 object which contains the following fields:
from_address
string
REQUIRED
The address of the L1 contract sending the message
to_address
string
REQUIRED
The target L2 address the message is sent to
entry_point_selector
string
REQUIRED
The selector of the l1_handler in invoke in the target contract
payload
array
REQUIRED
The payload of the message
block_id
string
REQUIRED
The hash of the requested block, the block number (height) of the requested block, or a block tag (latest or pending)

Returns

result
object
The result object with the following fields:
gas_consumed
string
The Ethereum gas consumption of the transaction
gas_price
string
The gas price (in wei or fri, depending on the tx version) that was used in the cost estimation
data_gas_consumed
string
The Ethereum data gas consumption of the transaction
data_gas_price
string
The data gas price (in wei or fri, depending on the tx version) that was used in the cost estimation
overall_fee
string
The estimated fee for the transaction (in wei or fri, depending on the tx version), equals to gas_consumed*gas_price + data_gas_consumed*data_gas_price
unit
string
The units in which the fee is given
Request
1
curl --location 'https://docs-demo.strk-mainnet.quiknode.pro/' \
2
--header 'accept: application/json' \
3
--header 'content-type: application/json' \
4
--data '{
5
"id": 1,
6
"jsonrpc": "2.0",
7
"method": "starknet_estimateMessageFee",
8
"params": [
9
{
10
"from_address": "FROM_ADDRESS",
11
"to_address": "TO_ADDRESS",
12
"entry_point_selector": "ENTRY_POINT_SELECTOR",
13
"payload": []
14
},
15
"latest"
16
]
17
}'
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free