Skip to main content

eth_estimateGas

POST

Estimates the energy consumption required to execute a transaction.Unlike Ethereum's eth_estimateGas, which returns a gas amount, TRON returns an energy amount.
param[0]
callObjectobjectrequired
The transaction to estimate energy consumption for.data and input are aliases for each other; when both are given, input takes precedence.
fromstring
The address of the account sending the transaction.
tostring
The address of the account or contract that will receive the transaction.
gasstring
The fee limit. Retained for Ethereum compatibility and ignored by TRON.
gasPricestring
The energy price. Retained for Ethereum compatibility and ignored by TRON.
valuestring
The amount of TRX sent via call_value, in sun.
datastring
The function selector and the ABI-encoded parameters.
inputstring
An alias for data. When both are given, this value takes precedence.When a value is given, it requires a 0x prefix and an even number of hex digits.
Responses
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://tron-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_estimateGas",
"params": [
{
"from": "0xf0cc5a2a84cd0f68ed1667070934542d673acbd8",
"to": "0x70082243784dcdf3042034e7b044d6d342a91360",
"gas": "0x01",
"gasPrice": "0x8c",
"value": "0x01",
"data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
}
]
}'