POSTeth_estimateGas

Tron Mainnethttps://tron-mainnet.nodit.io/

Estimates the energy consumption required to execute a transaction. Unlike Ethereum's eth_estimateGas, which returns a gas amount, TRON returns an energy amount.

Request Body
idintegerrequired
jsonrpcstringrequired
methodstringrequired
paramsoneOf[]required

It contains following parameter in order:

  1. callObject: The transaction to execute, as an object. (required)
params[0]object
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

응답 본문이 없습니다.

X-API-KEY
RequestCU20
cURL
curl -X POST "https://tron-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "from": "0xf0cc5a2a84cd0f68ed1667070934542d673acbd8",
      "to": "0x70082243784dcdf3042034e7b044d6d342a91360",
      "gas": "0x01",
      "gasPrice": "0x8c",
      "value": "0x01",
      "data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
    }
  ]
}'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x0"
}