Replay transaction trace (Parity-style)
https://api.triport.io/v1/polygon/trace/replay-txRe-executes an already-mined Polygon transaction and returns its Parity-style trace envelope (call trace, VM trace, and/or state diff).
POST /v1/polygon/trace/replay-tx replays a transaction that has already been
included in a Polygon block and returns its Parity-style (trace_*) output.
It is the canonical way to understand exactly what a transaction did on-chain:
the tree of internal calls it made, the gas each frame consumed, where it
reverted, and — when requested — the full VM step trace and the set of state
changes it produced.
You choose what to compute with the tracers array. Pass trace (the default)
for the flat list of call frames, vmTrace for the step-by-step VM trace, and
stateDiff for the before/after state delta. You can request any combination;
each requested tracer adds its own top-level key to the response envelope, and
keys you did not request are returned as null.
Exclusive availability. Triport exposes the only freely available Polygon Parity-trace canal — equivalent access elsewhere is gated behind paid plans. Because tracing is computationally heavy and the upstream canal is rate-constrained, this endpoint requires the Pro tier and above and is rate-limited per tier. Trace only the transactions you genuinely need to inspect.
Parameters
Request body (application/json):
tx_hashstringrequired0x-prefixed 32-byte hash of the transaction to replay. Must match ^0x[0-9a-fA-F]{64}$ and reference a transaction that is already mined.tracersstring[]optionaltrace, vmTrace, or stateDiff. Defaults to ["trace"]. Unrequested tracers come back as null in the response.Response
The response is the Parity-style trace envelope. The example below is the result
for the default ["trace"] request — vmTrace and stateDiff are null
because they were not requested.
tracearray | nulltrace was requested.vmTraceobject | nullvmTrace was requested, otherwise null.stateDiffobject | nullfrom/to). Present when stateDiff was requested, otherwise null.outputstring0x-prefixed hex return data of the top-level call.Errors
| Code | Meaning | When it happens |
|---|---|---|
400 | invalid_params | Body is missing tx_hash, tx_hash does not match ^0x[0-9a-fA-F]{64}$, or tracers contains a value other than trace / vmTrace / stateDiff. |
401 | unauthorized / trial_expired / subscription_expired | No or invalid credentials, or the key's trial / subscription has lapsed. |
403 | tier_insufficient / method_unknown | The key's tier is below Pro (response carries current_tier, required_tier, upgrade_url), or the method is not part of this product. |
429 | rate_limited | You exceeded your tier's sustained RPS (including the ×2 burst). Honor the Retry-After header / retry_after_sec and retry after a short back-off. |
See the shared error envelope reference for the full error object shape and handling guidance.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/polygon/trace/replay-tx", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
tx_hash:
"0x5b8d2a3c9f1e7b04c6f2a1d8e3047b9a6c1f0e2d4b8a7c5e9f3a1d2c4b6e8f0a",
tracers: ["trace"],
}),
});
const envelope = await res.json();
console.log(envelope.trace?.length ?? 0, envelope.output);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.replayTx({
tx_hash:
"0x5b8d2a3c9f1e7b04c6f2a1d8e3047b9a6c1f0e2d4b8a7c5e9f3a1d2c4b6e8f0a",
tracers: ["trace", "stateDiff"],
});
console.log(envelope.trace, envelope.stateDiff);Python (triport-sdk)
import os
from triport import Triport
triport = Triport(api_key=os.environ["TRIPORT_API_KEY"])
envelope = triport.polygon.trace.replay_tx(
tx_hash="0x5b8d2a3c9f1e7b04c6f2a1d8e3047b9a6c1f0e2d4b8a7c5e9f3a1d2c4b6e8f0a",
tracers=["trace"],
)
print(len(envelope["trace"]), envelope["output"])Notes
- Request only the tracers you need.
vmTraceandstateDiffare substantially larger and more expensive than the defaulttrace; adding them to every call will exhaust your tier's RPS budget faster. - The transaction must already be mined. To trace a hypothetical call that
has not been sent, use
POST /v1/polygon/trace/call, which takes a fulltxpayload and ablocktag instead of atx_hash. - The trace output is a pass-through Parity-style envelope; fields beyond those documented above may appear depending on the requested tracers, so decode it defensively.
- This endpoint covers Polygon PoS. For Ethereum execution traces, use the
Ethereum debug-namespace methods such as
debug_traceTransaction.