TriportRPC

eth_call

POSThttps://api.triport.io/v1/ethereum

Executes a read-only message call against the EVM at a chosen block, without creating, signing, or broadcasting a transaction.

Ethereumeth_read_rpcfree — 10 RPS · basic — 20 RPS · pro — 100 RPS · business — 250 RPS

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

Positional params array: [transaction, blockParameter].

1. transaction (, required)object
tostring (20-byte hex address)required
Address of the contract being called.
datastring (hex)optional
ABI-encoded function selector + arguments. Omitting it calls the contract's fallback/receive.
fromstring (20-byte hex address)optional
Address the call is made from (msg.sender). Defaults to the zero address.
gasstring (hex)optional
Gas cap for the simulated execution. Defaults to a node-side maximum.
gasPricestring (hex)optional
Gas price used during simulation.
valuestring (hex)optional
Wei sent with the call (msg.value).
2. blockParameter (string, required)object

Response

Response fields

FieldTypeDescription
jsonrpcstringAlways "2.0".
idnumber | stringEchoes the request id.
resultstring (hex)ABI-encoded return data of the call. "0x" if the function returns nothing. Decode against the function's return ABI (here, 0x…2540be400 = 10000000000 = 10,000 USDT at 6 decimals).

Errors

CodeMeaningWhen it happens
-32001trial_expiredThe API key's trial period has ended; upgrade to a paid tier to continue.
-32003rate_limitedPer-tier RPS limit exceeded (10 / 20 / 100 / 250 RPS for free / basic / pro / business). Retry after backing off.
-32602Invalid paramsMalformed transaction object, bad address, or missing block parameter.
3Execution revertedThe simulated call reverted; the error.data field holds the ABI-encoded revert reason.

Every error follows the shared JSON-RPC error envelope — see Errors for the full structure and handling guidance.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/ethereum", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "eth_call",
    params: [
      {
        to: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        data: "0x70a08231000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9b",
      },
      "latest",
    ],
  }),
});


const { result } = await res.json();
console.log(BigInt(result).toString()); // raw balance

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const result = await triport.ethereum.call(
  {
    to: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    data: "0x70a08231000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9b",
  },
  "latest",
);


console.log(BigInt(result).toString());

Python (triport-sdk)

import os
from triport import Triport


triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])


result = triport.ethereum.call(
    {
        "to": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "data": "0x70a08231000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9b",
    },
    "latest",
)


print(int(result, 16))

Notes

  • No gas is spent. eth_call never costs ETH and never alters state; it only reads. To get the gas a real transaction would use, call eth_estimateGas.
  • Reverts vs. results. A reverting call returns a JSON-RPC error (code 3), not an empty result. Always check for error before decoding result.
  • Historical reads. Passing a hex block number reads state as of that block, subject to the node's archive depth.
  • from matters only for permissioned logic. Set it when the contract gates behavior on msg.sender; otherwise it can be omitted.
  • Related methods: eth_estimateGas, eth_getBalance, eth_getCode.