Polygon
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Polygon
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
trace_call simulates a call against a chosen Polygon PoS block state and returns the result in the OpenEthereum/Parity format, with no transaction broadcast and no MATIC spent. You pick exactly which detail you want through traceTypes: the trace call tree, an opcode-level vmTrace, and a stateDiff showing balance, nonce, code, and storage changes. Send the request to https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89). It simulates the call against the given block state and returns an OpenEthereum-style call-tree trace, optional VM trace, and optional state diff — without creating a transaction.
traceTypes: ["trace"].stateDiff to confirm a prospective transaction changes exactly the slots you expect on a Polygon DeFi contract.blockParameter (past blocks need a Bor archive node).| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | transaction | object | Sí | Call object: `from?`, `to`, `gas?`, `gasPrice?`, `value?`, `data?`. |
| 2 | traceTypes | array | Sí | Array of trace types to include: `"trace"` (call tree), `"vmTrace"` (opcode-level), `"stateDiff"` (storage/balance diffs). |
| 3 | blockParameter | string | No | Block state against which to simulate the call.Predeterminado: latest |
| Tipo | Descripción |
|---|---|
| object | `{output, trace?, stateDiff?, vmTrace?}` — `trace` is a flat call-tree array, `stateDiff` maps each touched address to its balance/nonce/code/storage diffs, `vmTrace` provides opcode-level detail (Parity-format). |
Try it live in the Polygon playground.
| Código | Mensaje | Causa |
|---|---|---|
-32601 | Method not found | trace namespace not enabled or client does not support trace_call. |
-32602 | Invalid params | Transaction object missing required fields, traceTypes array is empty or contains unrecognized values, or blockParameter is invalid. |
-32000 | execution reverted | Simulated call reverted; partial trace is still returned. |
trace + vmTrace + stateDiff) can balloon the response on a busy Polygon contract — request only the types you actually consume.vmTrace format is Parity-specific and does not match Bor's Geth-style debug_traceCall struct-log — do not feed one into a parser written for the other.Parámetros
Call object: `from?`, `to`, `gas?`, `gasPrice?`, `value?`, `data?`.
["trace"] | ["trace","vmTrace","stateDiff"] — at least one required
hex block number or "latest" | "earliest" | "pending"