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://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_call",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", 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.