Skip to main content

eth_call

POST

Executes a contract function immediately in a read-only manner. It does not create a transaction on the chain.It is functionally equivalent to triggerConstantContract of the FullNode HTTP API.

📘 Execution always runs against the latest state, so the state at a past block cannot be reproduced.

param[0]
callObjectobjectrequired
The transaction call object used to call a contract.data and input are aliases for each other; when both are given, input takes precedence.
fromstring
The caller address. Pass it in the TRON hexadecimal address form with the 41 prefix removed.
tostring
The contract address. Pass it in the TRON hexadecimal address form with the 41 prefix removed.
gasstring
Retained for Ethereum compatibility. It is not used by the TRON implementation.
gasPricestring
Retained for Ethereum compatibility. It is not used by the TRON implementation.
valuestring
The amount of TRX sent with the call, in sun, passed in hexadecimal.It maps to msg.value during simulation; no actual funds are transferred.
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; an empty string means empty bytes.
param[1]
blockstringrequired
The block to query against. The string form supports only latest, andearliest, pending, finalized and safe cannot be used.In the object form, if both blockNumber and blockHash are given, blockNumber takes precedence.
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_call",
"params": [
{
"from": "0xf0cc5a2a84cd0f68ed1667070934542d673acbd8",
"to": "0x70082243784dcdf3042034e7b044d6d342a91360",
"gas": "0x0",
"gasPrice": "0x0",
"value": "0x0",
"data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
},
"latest"
]
}'