trace_block
https://api.triport.io/v1/polygonReturns the complete Parity-style call tree for every transaction in a single Polygon block.
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
transferFromand 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.
blockstringrequired0x-prefixed hex block number (e.g. "0x3A2B4C0") or a block tag (latest, earliest).Response
Response fields
| Field | Type | Description |
|---|---|---|
result | array | One entry per trace frame across the whole block, ordered by transaction position and then by execution order within each transaction. |
result[].action | object | The call that produced this frame. |
result[].action.callType | string | Type of call: call, delegatecall, staticcall, etc. May vary by Bor execution shape (see note above). |
result[].action.from | string | Address that initiated the call. |
result[].action.to | string | Target address of the call. |
result[].action.value | string | 0x-prefixed hex wei value transferred. |
result[].action.gas | string | 0x-prefixed hex gas supplied to the call. |
result[].action.input | string | Call input data. |
result[].result | object | Outcome of the call: gasUsed and output (absent and replaced by an error string on a reverted frame). |
result[].subtraces | number | Number of direct child calls of this frame. |
result[].traceAddress | array | Path of this frame within its transaction's call tree (empty for the top-level call). |
result[].type | string | Frame type — call, create, or suicide. |
result[].blockHash | string | Hash of the block being traced. |
result[].blockNumber | number | Number of the block being traced. |
result[].transactionHash | string | Hash of the transaction this frame belongs to. |
result[].transactionPosition | number | Index of that transaction within the block. |
Errors
| Code | Meaning | When it happens |
|---|---|---|
-32002 | tier_insufficient | Your API key's tier is below Pro; the polygon_trace category is not enabled for it. |
-32003 | rate_limited | You 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 a0x-prefixed hex block number. Tracinglatestis 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, usetrace_call. To filter trace frames across a block range by address, usetrace_filter. For full per-transaction state diffs in addition to the trace, usetrace_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.