TriportRPC

Replay transaction trace (Parity-style)

POSThttps://api.triport.io/v1/polygon/trace/replay-tx

Re-executes an already-mined Polygon transaction and returns its Parity-style trace envelope (call trace, VM trace, and/or state diff).

Polygonpolygon_tracePro and above — RPS-limited per tier (burst ×2)

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_hashstringrequired
The 0x-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[]optional
Which traces to compute. Each item is one of trace, 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 | null
Flat list of call frames in execution order. Present when trace was requested.
vmTraceobject | null
Step-by-step VM execution trace. Present when vmTrace was requested, otherwise null.
stateDiffobject | null
Per-account state delta (balance / nonce / code / storage, each as from/to). Present when stateDiff was requested, otherwise null.
outputstring
0x-prefixed hex return data of the top-level call.

Errors

CodeMeaningWhen it happens
400invalid_paramsBody 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.
401unauthorized / trial_expired / subscription_expiredNo or invalid credentials, or the key's trial / subscription has lapsed.
403tier_insufficient / method_unknownThe key's tier is below Pro (response carries current_tier, required_tier, upgrade_url), or the method is not part of this product.
429rate_limitedYou 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. vmTrace and stateDiff are substantially larger and more expensive than the default trace; 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 full tx payload and a block tag instead of a tx_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.