trace_call
https://api.triport.io/v1/ethExecutes a transaction call against the state of a chosen block and returns the requested Parity-style traces (`trace`, `vmTrace`, `stateDiff`) without broadcasting anything.
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].
callObjectobjectrequiredtraceTypesarray of stringsrequired"trace", "vmTrace", "stateDiff".blockParameterstringoptional0x10d4f) or a tag: latest, earliest, pending, safe, finalized. Defaults to latest.callObject fieldsobjecttostringrequiredfromstringoptionaldatastringoptionalvaluestringoptionalgasstringoptionalgasPricestringoptionalResponse
Response fields
result is a single object containing one entry per trace type. Entries you did
not request are null.
| Field | Type | Description |
|---|---|---|
result.output | string | Hex-encoded return data of the simulated call. |
result.trace | array | Flat list of call/create/suicide actions. Present when "trace" was requested, else null. |
result.trace[].action | object | The action performed (callType, from, to, value, gas, input). |
result.trace[].result | object | Outcome of the action (gasUsed, output). Replaced by error if the action reverted. |
result.trace[].subtraces | number | Number of child actions spawned by this action. |
result.trace[].traceAddress | array | Path of this action within the call tree. |
result.trace[].type | string | Action type: call, create, suicide. |
result.stateDiff | object | Per-address storage/balance/nonce/code before-after diffs. Present when "stateDiff" was requested, else null. |
result.vmTrace | object | Opcode-level VM execution trace. Present when "vmTrace" was requested, else null. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
| -32602 | Invalid params | Malformed call object, unknown trace type in traceTypes, or a bad block parameter. |
| -32002 | Tier insufficient | API key is on the free tier; trace methods require pro or business. |
| -32003 | Rate limited | Per-second limit for your tier exceeded; back off and retry. |
| -32000 | Server error | Block 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.
vmTraceandstateDiffare considerably more expensive to produce — and far larger — than a plain["trace"]call. trace_callis the Parity/OpenEthereum-style tracer. For the Geth-style struct/callTraceroutput of the same simulation, usedebug_traceCallinstead.- To trace a transaction that has already been mined, use
trace_transaction. To filter historical traces across a block range, usetrace_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_callis cheaper.