TriportRPC

trace_block

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

Returns the complete Parity-style call tree for every transaction in a single Polygon block.

Polygonpolygon_tracePro and up — pro 3 rps · business 10 rps (category polygon_trace)

trace_block returns the full Parity-style execution trace for all transactions in one block. The result is a flat array of trace frames: every external call and every internal call (call, delegatecall, staticcall, create, suicide) produced while the block executed, tagged with the transaction it belongs to and its position in the call tree. This is the whole-block counterpart to trace_transaction, which traces a single transaction.

Use it when you need the complete internal-execution picture of a block rather than just its receipts. Typical use cases:

  • MEV indexing — reconstruct the full execution path of each transaction to detect sandwiches, atomic arbitrage, and JIT liquidity.
  • DeFi internal-transfer tracking — follow transferFrom and value moves between contracts that never appear as top-level transactions.
  • Compliance / forensic auditing — produce a verifiable execution trail for a transaction inside its block context.

This is a premium trace method: it requires the Pro tier or above and is rate limited per tier (3 RPS on Pro, 10 RPS on Business) with a short burst allowance. There is no daily quota. Tracing a whole block is heavy: a typical Polygon block holds ~50–150 transactions, each expanding into several to many trace frames, so a single response is commonly 100 KB–2 MB and latency runs into the seconds. Keep concurrency low and prefer recent or specific blocks over wide historical sweeps.

Trace-shape note. Polygon runs the Bor execution layer, whose trace output can differ slightly from a stock Geth/Parity node — most visibly in how a frame is typed ("call" vs "delegatecall" and the other call variants). Write your indexer to accept both type spellings rather than matching one exact string.

Parameters

Positional parameters: a single block reference.

blockstringrequired
The block to trace, given as a 0x-prefixed hex block number (e.g. "0x3A2B4C0") or a block tag (latest, earliest).

Response

Response fields

FieldTypeDescription
resultarrayOne entry per trace frame across the whole block, ordered by transaction position and then by execution order within each transaction.
result[].actionobjectThe call that produced this frame.
result[].action.callTypestringType of call: call, delegatecall, staticcall, etc. May vary by Bor execution shape (see note above).
result[].action.fromstringAddress that initiated the call.
result[].action.tostringTarget address of the call.
result[].action.valuestring0x-prefixed hex wei value transferred.
result[].action.gasstring0x-prefixed hex gas supplied to the call.
result[].action.inputstringCall input data.
result[].resultobjectOutcome of the call: gasUsed and output (absent and replaced by an error string on a reverted frame).
result[].subtracesnumberNumber of direct child calls of this frame.
result[].traceAddressarrayPath of this frame within its transaction's call tree (empty for the top-level call).
result[].typestringFrame type — call, create, or suicide.
result[].blockHashstringHash of the block being traced.
result[].blockNumbernumberNumber of the block being traced.
result[].transactionHashstringHash of the transaction this frame belongs to.
result[].transactionPositionnumberIndex of that transaction within the block.

Errors

CodeMeaningWhen it happens
-32002tier_insufficientYour API key's tier is below Pro; the polygon_trace category is not enabled for it.
-32003rate_limitedYou exceeded your tier's request rate (3 RPS on Pro, 10 RPS on Business) including burst. Back off and retry.

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", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "trace_block",
    params: ["latest"],
  }),
});


const { result } = await res.json();
console.log(result.length, "trace frames in block");

TypeScript SDK (@triport/sdk)

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


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


const frames = await triport.polygon.request("trace_block", ["latest"]);


// Group frames by the transaction they belong to.
const byTx = new Map<string, unknown[]>();
for (const frame of frames) {
  const list = byTx.get(frame.transactionHash) ?? [];
  list.push(frame);
  byTx.set(frame.transactionHash, list);
}

Python (triport-sdk)

import os
from triport import Triport


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


frames = triport.polygon.request("trace_block", ["latest"])
print(len(frames), "trace frames in block")

Notes

  • Pass either a block tag (latest, earliest) or a 0x-prefixed hex block number. Tracing latest is the common path for real-time MEV detection; historical blocks are available for indexing and archival analysis.
  • Responses are large (100 KB–2 MB) and slow (seconds, not milliseconds). Keep concurrency low — a handful of in-flight requests is plenty — and avoid fanning the method across long block ranges in parallel.
  • For a single transaction rather than a whole block, use trace_transaction. To simulate and trace a call that is not yet on chain, use trace_call. To filter trace frames across a block range by address, use trace_filter. For full per-transaction state diffs in addition to the trace, use trace_replayBlockTransactions.
  • The Geth-style equivalent of this method is debug_traceBlockByNumber, which returns a nested call-tree shape rather than the flat Parity frame array. Cross-checking the two is useful for trace-shape verification.