debug
The debug namespace provides RPC endpoints designed for developers to inspect and debug the internal workings of the node. These endpoints offer detailed execution traces for transactions and calls, enable inspection of account storage, and allow for simulation of state changes. They are especially useful during development and troubleshooting to gain insight into the node’s processing of transactions and blocks.
debug_accountRange
Description: Returns a range of account-related information. This function may be used to inspect a segment of the state related to account data.
Sample Request:
Expected Response:
Parameters:
startKey (string): The starting key of the account range.
endKey (string): The ending key of the account range.
debug_backtraceAt
Description: Returns the execution backtrace at a specified program counter (PC) or function name, helping to diagnose where errors occur.
Sample Request:
Expected Response:
Parameters:
location (string): The function name or PC value at which to retrieve the backtrace.
debug_blockProfile
Description: Starts profiling of block processing. Useful for gathering performance metrics on block execution.
Sample Request:
Expected Response:
Parameters: None.
debug_chaindbCompact
Description: Triggers a compaction of the chain database to reclaim space and improve performance.
Sample Request:
Expected Response:
Parameters: None.
debug_chaindbProperty
Description: Retrieves a specific property from the chain database.
Sample Request:
Expected Response:
Parameters:
propertyName (string): The name of the database property to retrieve.
debug_cpuProfile
Description: Generates a CPU profile of the node’s current execution for performance analysis.
Sample Request:
Expected Response:
Parameters:
profileName (string): A name identifier for the CPU profile.
debug_dbAncient
Description: Accesses a specific ancient (old) data entry from the database.
Sample Request:
Expected Response:
Parameters:
ancientKey (string): The key or identifier for the ancient data.
debug_dbAncients
Description: Lists all available ancient data entries in the database.
Sample Request:
Expected Response:
Parameters: None.
debug_dbGet
Description: Retrieves a value from the database using a given key.
Sample Request:
Expected Response:
Parameters:
dbKey (string): The key for the database entry.
debug_dumpBlock
Description: Dumps detailed information about a block for debugging purposes.
Sample Request:
Expected Response:
Parameters:
blockHash (string): The hash of the block to dump.
debug_freeOSMemory
Description: Forces the node to free unused memory back to the operating system.
Sample Request:
Expected Response:
Parameters: None.
debug_freezeClient
Description: Freezes the client’s state for debugging, preventing further state changes.
Sample Request:
Expected Response:
Parameters: None.
debug_gcStats
Description: Returns statistics about the garbage collection (GC) performance and memory usage.
Sample Request:
Expected Response:
Parameters: None.
debug_getAccessibleState
Description: Returns information about the state that is accessible to the debugger, such as cached trie nodes.
Sample Request:
Expected Response:
Parameters: None.
debug_getBadBlocks
Description: Returns a list of blocks that have been marked as bad (i.e. invalid or corrupt).
Sample Request:
Expected Response:
Parameters: None.
debug_getModifiedAccountsByHash
Description: Returns a list of accounts modified in a specific state trie, identified by its state root hash.
Sample Request:
Expected Response:
Parameters:
stateRootHash (string)
debug_getModifiedAccountsByNumber
Description: Returns modified accounts for a given block number.
Sample Request:
Expected Response:
Parameters:
block (string): Block number or tag.
debug_getRawBlock
Description: Retrieves the raw block data in RLP-encoded format for a given block hash.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
debug_getRawHeader
Description: Retrieves the raw RLP-encoded block header for a given block hash.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
debug_getRawReceipts
Description: Returns the raw, RLP-encoded receipts for a given block hash.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
debug_getRawTransaction
Description: Retrieves the raw, RLP-encoded transaction data for a given transaction hash.
Sample Request:
Expected Response:
Parameters:
transactionHash (string)
debug_goTrace
Description: Returns a trace of Go runtime events that occurred during execution. This can help diagnose performance issues at the language runtime level.
Sample Request:
Expected Response:
Parameters: None.
debug_intermediateRoots
Description: Returns a list of intermediate state roots computed during block processing.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
debug_memStats
Description: Returns memory statistics of the node, including heap usage and GC metrics.
Sample Request:
Expected Response:
Parameters: None.
debug_mutexProfile
Description: Returns a profile of mutex contention in the node, useful for debugging concurrency issues.
Sample Request:
Expected Response:
Parameters: None.
debug_preimage
Description: Retrieves the preimage (original input) for a given hash, if available. This is used for state debugging and verification.
Sample Request:
Expected Response:
Parameters:
hash (string): The hash whose preimage is to be retrieved.
debug_printBlock
Description: Prints a human-readable representation of a block for debugging purposes.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
debug_seedHash
Description: Returns the seed hash used for generating the cache and dataset in Ethash. This is useful for verifying the current mining epoch parameters.
Sample Request:
Expected Response:
Parameters:
blockNumber (number): The block number for which to compute the seed hash.
debug_setBlockProfileRate
Description: Sets the rate at which block profiling data is collected.
Sample Request:
Expected Response:
Parameters:
rate (number): The sampling rate.
debug_setGCPercent
Description: Sets the target percentage of heap in use before triggering garbage collection.
Sample Request:
Expected Response:
Parameters:
percent (number): The desired GC percentage.
debug_setHead
Description: Manually sets the head (latest block) of the chain. This is primarily for debugging purposes.
Sample Request:
Expected Response:
Parameters:
blockHash (string): The hash to set as the new head.
debug_setMutexProfileFraction
Description: Adjusts the fraction of mutex events that are profiled. This can help in diagnosing lock contention issues.
Sample Request:
Expected Response:
Parameters:
fraction (number): The profile fraction.
debug_setTrieFlushInterval
Description: Sets the interval at which the state trie is flushed to disk.
Sample Request:
Expected Response:
Parameters:
interval (number): The flush interval in number of operations or time units.
debug_stacks
Description: Returns the current stack traces for all goroutines. This is useful for diagnosing deadlocks and performance issues.
Sample Request:
Expected Response: A long string containing stack traces.
Parameters: None.
debug_standardTraceBadBlockToFile
Description: Writes a standard trace of a bad block to a file for later analysis.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
filename (string)
debug_standardTraceBlockToFile
Description: Writes a standard trace of a block to a file.
Sample Request:
Expected Response:
Parameters:
blockHash (string)
filename (string)
debug_startCPUProfile
Description: Starts CPU profiling and writes the profile data to a specified file.
Sample Request:
Expected Response:
Parameters:
filename (string): The output file name for the CPU profile.
debug_startGoTrace
Description: Starts Go runtime tracing and writes the trace data to a specified file.
Sample Request:
Expected Response:
Parameters:
filename (string): The output file for the trace.
debug_stopCPUProfile
Description: Stops the CPU profiling that was previously started.
Sample Request:
Expected Response:
Parameters: None.
debug_stopGoTrace
Description: Stops the Go runtime tracing.
Sample Request:
Expected Response:
Parameters: None.
debug_storageRangeAt
Description: Returns a range of storage entries for a given contract at a specified block and transaction index.
Sample Request:
Expected Response:
Parameters:
blockNumber (string): The block number in hex.
transactionIndex (string): The index of the transaction in hex.
contractAddress (string): The address of the contract.
startKey (string): The storage key to start from.
maxResults (number): Maximum number of entries to return.
debug_traceBadBlock
Description: Traces the execution of a block that is known to be bad (invalid or corrupt) and returns detailed trace data.
Sample Request:
Expected Response:
Parameters:
blockHash (string): The hash of the bad block.
debug_traceBlock
Description: Traces the execution of a block and returns detailed execution traces including opcode level logs.
Sample Request:
Expected Response: An object containing detailed trace logs.
Parameters:
blockHash (string): The hash of the block to trace.
debug_traceBlockByHash
Description: Traces the execution of a block identified by its hash.
Sample Request:
Expected Response: Same as debug_traceBlock.
Parameters:
blockHash (string)
debug_traceBlockByNumber
Description: Traces the execution of a block by its number (or tag).
Sample Request:
Expected Response: Returns detailed trace logs for the block.
Parameters:
block (string): Block number in hex or tag (e.g., "latest").
debug_traceBlockFromFile
Description: Traces a block using data read from a file, which contains a previously exported block trace.
Sample Request:
Expected Response: Returns the trace data extracted from the file.
Parameters:
filename (string): The file containing the block trace.
debug_traceCall
Description: Simulates a transaction call and returns an execution trace, including opcode steps, gas usage, and state changes.
Sample Request:
Expected Response: Returns a trace object similar to:
Parameters:
callObject (object): Contains transaction call details.
blockIdentifier (string): Block number/tag.
traceConfig (object): Optional config to disable memory, stack, or storage traces.
debug_traceTransaction
Description: Returns a detailed execution trace for a given transaction, showing all opcodes executed, gas used per step, and state changes.
Sample Request:
Expected Response:
Parameters:
transactionHash (string)
debug_verbosity
Description: Sets or retrieves the current logging verbosity level of the node for debugging purposes.
Sample Request (Set Verbosity):
Expected Response:
Parameters:
level (number): The verbosity level (e.g., 0 for minimal logging, higher numbers for more detailed logs).
debug_vmodule
Description: Sets the logging module-specific verbosity. This allows fine-grained control over logging output for specific components.
Sample Request:
Expected Response:
Parameters:
vmodule (string): A string defining module-specific verbosity settings.
debug_writeBlockProfile
Description: Writes the current block profile data to a specified file for offline analysis.
Sample Request:
Expected Response:
Parameters:
filename (string): The target file name.
debug_writeMemProfile
Description: Writes the current memory profile to a file.
Sample Request:
Expected Response:
Parameters:
filename (string)
debug_writeMutexProfile
Description: Writes the current mutex contention profile to a file.
Sample Request:
Expected Response:
Parameters:
filename (string)
Last updated