Simulate call with Parity trace output
https://api.triport.io/v1/polygon/trace/callExecutes a contract call against the state of a chosen Polygon block and returns the full Parity-style execution trace — without broadcasting anything.
POST /v1/polygon/trace/call simulates an eth_call against a chosen Polygon
block and returns a structured Parity-style trace of the execution instead of
just the call's return data. Nothing is broadcast and no state is persisted — the
call is evaluated read-only against the state at the block you name. Use it to
debug why a call reverts, to inspect the internal call tree and gas accounting,
or to preview a transaction's effect before sending it via
POST /v1/polygon/sender/raw.
The shape of the trace is controlled by the tracers array. Each entry selects
one output section: trace (the call/create tree), vmTrace (a VM-level
step-by-step trace), and stateDiff (the set of state changes the call would
produce). You may request any combination; sections you do not ask for are
returned as null.
Exclusive availability. Parity
trace_*methods are served on Polygon through a throughput-constrained, exclusively-available canal. Because tracing is far more expensive than a plain read, this endpoint is gated to the pro tier and above, and is rate-limited more tightly than standard wallet reads — keep request rates modest and batch trace work where you can.
Parameters
This endpoint takes a JSON request body. All three top-level fields are required.
txobjectrequiredtracersarray of stringrequiredtrace, vmTrace, stateDiff.blockstringrequiredlatest, pending, safe, finalized.tx fieldsobjectfromstringoptional0x-prefixed). Defaults to the zero address.tostringoptionaldatastringoptionalvaluestringoptionalgasstringoptionaltracers valuesobjectResponse
A Parity-style trace envelope. Sections you did not request in tracers are
returned as null. The example below requested only trace:
outputstringtracearraytrace was requested, otherwise null.trace[].actionobjectcallType, from, to, value, gas, input.trace[].resultobjectgasUsed, output. Replaced by an error field if the frame reverted.trace[].subtracesintegertrace[].traceAddressarraytrace[].typestringcall, create, suicide, etc.vmTraceobjectvmTrace was requested, otherwise null.stateDiffobjectstateDiff was requested, otherwise null.Errors
| Code | Meaning | When it happens |
|---|---|---|
| 400 | invalid_params | Missing tx, tracers, or block; an unknown tracer name; or a malformed call object / block tag. |
| 401 | unauthorized / trial_expired / subscription_expired | No or invalid credentials, or the key's trial / subscription has ended. |
| 403 | tier_insufficient / method_unknown | Key is below the pro tier, or trace is not part of the key's product. |
| 429 | rate_limited | Sustained RPS for your tier exceeded; honour the Retry-After header and back off. |
See errors.md for the full error envelope, the per-code body
shapes, and the X-RateLimit-* headers returned on 429.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/polygon/trace/call", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
tx: {
from: "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
to: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
data: "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
},
tracers: ["trace"],
block: "latest",
}),
});
const envelope = await res.json();
console.log(envelope.trace);TypeScript SDK (@triport/sdk)
import { Triport } from "@triport/sdk";
const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });
const envelope = await triport.polygon.trace.call({
tx: {
from: "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
to: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
data: "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
},
tracers: ["trace"],
block: "latest",
});
console.log(envelope.trace);Python (triport-sdk)
import os
from triport import Triport
triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])
envelope = triport.polygon.trace.call(
tx={
"from": "0x8894e0a0c962cb723c1976a4421c95949be2d4e3",
"to": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
"data": "0xa9059cbb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc40000000000000000000000000000000000000000000000000000000000000064",
},
tracers=["trace"],
block="latest",
)
print(envelope["trace"])Notes
- A call that reverts is still a successful (200) response: the revert surfaces
inside the trace as an
errorfield on the offending frame, not as a top-level HTTP error. - Request only the
tracerssections you need.vmTracein particular can produce very large bodies for complex calls. - To trace a transaction that has already been mined rather than a simulated
call, use
POST /v1/polygon/trace/replay-tx. - Authentication also accepts the
X-API-Keyheader or the legacy?api-key=query parameter — see authentication.md. Bearer is recommended. - For tier thresholds and how RPS-with-burst limiting works, see rate-limits-and-tiers.md.