eth_call
Last updated:
eth_call runs a contract message call in the context of the current EVM state
(or a historical block) and returns whatever the call would have returned, as
hex-encoded data. Nothing is mined: there is no transaction, no signature, no
gas is spent, and no state change is persisted. It is the workhorse for reading
on-chain data — token balances, allowances, pool reserves, the output of any
view/pure function, or a dry-run of a state-changing function to preview its
return value or revert reason.
Because the call is simulated, from is optional and may be any address; supply
it only when the target contract's logic depends on msg.sender. The second
parameter selects the block at which state is read — pass "latest" for current
state, a hex block number for a historical read, or a tag like "pending",
"safe", or "finalized".
If the underlying call reverts, the request returns a JSON-RPC error (code 3,
"execution reverted") rather than a result; decode the data field to recover
the revert reason. For gas estimation use eth_estimateGas instead.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/eth \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"eth_call","params":[],"jsonrpc":"2.0"}'const res = await fetch("https://triport.io/eth", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"id": 1,
"method": "eth_call",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/eth",
headers={"Authorization": "Bearer <api-key>"},
json={"id":1,"method":"eth_call","params":[],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_call do?
- Executes a read-only message call against the EVM at a chosen block, without creating, signing, or broadcasting a transaction.
- How many credits does eth_call cost?
- eth_call costs 1 credit(s) per call on Triport by default.
- Is eth_call available over WebSocket?
- eth_call is an HTTP JSON-RPC method.