Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Give trace_replayTransaction the hash of a transaction that already landed on Ethereum, and the node re-runs it against the state that existed just before it executed, then returns whatever depth of detail you select. You choose any combination of three views: trace (the call tree), vmTrace (an opcode-by-opcode record), and stateDiff (every balance, nonce, code, and storage slot the transaction altered, marked with +, -, *, or =). It's the single-transaction member of the replay family on Ethereum mainnet (chain ID 1), where its block-wide sibling handles entire blocks. Replay requests go to https://ethereum.therpc.io/YOUR_API_KEY and require an archive node, since reconstructing the pre-transaction state means reaching back into history.
stateDiff lists each touched slot with its before and after value, which is what forensic work on a hack or a mispriced trade depends on.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | transactionHash | string | Sim | Hash of the transaction to replay. |
| 2 | traceTypes | array | Sim | One or more of `"trace"`, `"vmTrace"`, `"stateDiff"`. At least one value is required. |
| Tipo | Descrição |
|---|---|
| object | `{output, trace?, stateDiff?, vmTrace?}` — `trace` is the call tree, `stateDiff` maps each affected address to balance/nonce/code/storage diffs using `=` (unchanged), `+` (created), `-` (deleted), `*{from,to}` (modified), `vmTrace` is the Parity-format opcode trace. |
Try it live in the Ethereum playground.
| Código | Mensagem | Causa |
|---|---|---|
-32601 | Method not found | trace namespace not enabled or not supported by this client (primarily OpenEthereum/Nethermind/Erigon). |
-32602 | Invalid params | Transaction hash is missing/malformed or traceTypes is empty or contains unknown values. |
-32000 | transaction not found | Transaction does not exist or archive trace data is unavailable for that block. |
vmTrace on a complex transaction (a multi-hop DEX route, a flash-loan unwind) generates an enormous opcode log. When you only need call structure or storage changes, stick to ["trace"] or ["stateDiff"].vmTrace is Parity-format, not Geth's structLog. If you're migrating from debug_traceTransaction, expect a different schema and adjust your decoder accordingly.Parâmetros
0x-prefixed 32-byte hash
["trace"] | ["trace","vmTrace","stateDiff"]