Skip to main content
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

debug Methods

The debug namespace provides 5 debugging and development methods for transaction tracing and block analysis.
Debug methods are not part of the standard JSON-RPC spec and may not be available on all nodes. They are typically only enabled on development and testing nodes.

Overview

Access debug methods directly on the provider:

Transaction Tracing

debug_traceTransaction

Trace the execution of a transaction, returning detailed information about each step.
Parameters:
  • transactionHash: Hash - Transaction to trace
  • options?: TraceOptions - Tracing configuration
Common Tracers:
  • callTracer - Call tree with gas and value transfers
  • prestateTracer - State before transaction execution
  • 4byteTracer - Count of 4-byte function selectors
  • opcodeTracer - Full opcode-level trace
Example:

debug_traceBlockByNumber

Trace all transactions in a block by block number.
Parameters:
  • blockTag: BlockTag - Block to trace
  • options?: TraceOptions - Tracing configuration
Example:

debug_traceBlockByHash

Trace all transactions in a block by block hash.
Parameters:
  • blockHash: Hash - Block hash to trace
  • options?: TraceOptions - Tracing configuration
Example:

debug_traceCall

Trace a call without creating a transaction (like eth_call with tracing).
Parameters:
  • callParams: CallParams - Transaction parameters
  • blockTag: BlockTag - Block to execute against
  • options?: TraceOptions - Tracing configuration
Example:

Block Inspection

debug_getRawBlock

Get the RLP-encoded raw block data.
Parameters:
  • blockTag: BlockTag - Block to retrieve
Example:

Trace Options

Common options for tracing methods:

Usage Patterns

Debug Failed Transaction

Analyze Gas Usage

Test Before Sending

Compare State Changes

Node Requirements

Debug methods require specific node configuration: Geth:
Erigon:
Hardhat:
Anvil:

Performance Considerations

  • Tracing is expensive - Can take several seconds for complex transactions
  • Use timeouts - Prevent hanging on long traces
  • Disable unused features - disableMemory, disableStack for faster traces
  • Production nodes - Usually disable debug methods for security

Type Reference

All parameter and return types are defined in the JSON-RPC types module.

Next Steps