TriportRPC

trace_call

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

Executes a transaction call against the state of a chosen block and returns the requested Parity-style traces (`trace`, `vmTrace`, `stateDiff`) without broadcasting anything.

Ethereumeth_tracepro — 5 RPS · business — 15 RPS

trace_call simulates a transaction call exactly as eth_call would, evaluating it against the state at a chosen block, but instead of returning only the call's return data it returns the Parity/OpenEthereum-style traces you ask for. Nothing is broadcast and no state is persisted. Use it to inspect the internal call hierarchy of a transaction, to preview the exact storage and balance changes a call would cause, or to capture a low-level VM execution trace — all before sending the transaction on-chain.

You control which traces are produced with a trace-type array. Request any combination of:

  • trace — the flat list of call/create/suicide actions (the call tree).
  • vmTrace — a full virtual-machine execution trace, opcode by opcode.
  • stateDiff — the set of storage, balance, nonce, and code changes the call would apply, expressed as before/after diffs.

The method belongs to the trace namespace and is available on the pro and business tiers. Because producing traces is more expensive than a plain eth_call, the per-second limits are lower than for standard eth_* read methods.

Parameters

The params array is positional: [callObject, traceTypes, blockParameter].

callObjectobjectrequired
The transaction-call object to simulate. See fields below.
traceTypesarray of stringsrequired
Which traces to produce. Any subset of "trace", "vmTrace", "stateDiff".
blockParameterstringoptional
Block to evaluate the call against — a hex-encoded block number (e.g. 0x10d4f) or a tag: latest, earliest, pending, safe, finalized. Defaults to latest.
callObject fieldsobject
tostringrequired
Address of the contract being called.
fromstringoptional
Sender address the call executes as. Defaults to the zero address.
datastringoptional
Hex-encoded ABI call data (method selector + arguments).
valuestringoptional
Hex-encoded wei value to send with the call.
gasstringoptional
Hex-encoded gas limit for the call.
gasPricestringoptional
Hex-encoded gas price in wei.

Response

Response fields

result is a single object containing one entry per trace type. Entries you did not request are null.

FieldTypeDescription
result.outputstringHex-encoded return data of the simulated call.
result.tracearrayFlat list of call/create/suicide actions. Present when "trace" was requested, else null.
result.trace[].actionobjectThe action performed (callType, from, to, value, gas, input).
result.trace[].resultobjectOutcome of the action (gasUsed, output). Replaced by error if the action reverted.
result.trace[].subtracesnumberNumber of child actions spawned by this action.
result.trace[].traceAddressarrayPath of this action within the call tree.
result.trace[].typestringAction type: call, create, suicide.
result.stateDiffobjectPer-address storage/balance/nonce/code before-after diffs. Present when "stateDiff" was requested, else null.
result.vmTraceobjectOpcode-level VM execution trace. Present when "vmTrace" was requested, else null.

Errors

CodeMeaningWhen it happens
-32602Invalid paramsMalformed call object, unknown trace type in traceTypes, or a bad block parameter.
-32002Tier insufficientAPI key is on the free tier; trace methods require pro or business.
-32003Rate limitedPer-second limit for your tier exceeded; back off and retry.
-32000Server errorBlock not found, or the call could not be executed against the requested state.

See errors.md for the full error envelope.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/eth", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "trace_call",
    params: [
      {
        from: "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
        to: "0xb5a5f22694352c15b00323844ad545abb2b11028",
        data: "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
      },
      ["trace"],
      "latest",
    ],
  }),
});
const { result } = await res.json();
console.log(result.trace);

TypeScript SDK (@triport/sdk)

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


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


const result = await triport.eth.traceCall(
  {
    from: "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
    to: "0xb5a5f22694352c15b00323844ad545abb2b11028",
    data: "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
  },
  ["trace"],
  "latest",
);
console.log(result.trace);

Python (triport-sdk)

from triport import Triport


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


result = triport.eth.trace_call(
    {
        "from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
        "to": "0xb5a5f22694352c15b00323844ad545abb2b11028",
        "data": "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
    },
    ["trace"],
    "latest",
)
print(result["trace"])

Notes

  • Request only the trace types you need. vmTrace and stateDiff are considerably more expensive to produce — and far larger — than a plain ["trace"] call.
  • trace_call is the Parity/OpenEthereum-style tracer. For the Geth-style struct/callTracer output of the same simulation, use debug_traceCall instead.
  • To trace a transaction that has already been mined, use trace_transaction. To filter historical traces across a block range, use trace_filter.
  • Unlike eth_call (free tier), this method returns full traces rather than just the return data. If you only need the return value, eth_call is cheaper.