The debug and trace APIs are used by developers to debug and analyze smart contracts and transactions. The debug API allows for code execution simulation, while the `arbtrace API traces contract execution and gathers data on various performance metrics.
Developers can access the debug and trace tools on the Arbitrum blockchain with the following methods:
- debug_traceBlockByHash
- debug_traceBlockByNumber
- debug_traceTransaction
- debug_traceCall | Ethereum
- trace_transaction
- trace_block
Both elastic and dedicated Arbitrum nodes with debug and trace APIs enabled will expose the debug_*
and arbtrace_*
methods.
Blocks older than 22,207,815th were added to the chain before Nitro migration and cannot be queried with Geth methods. Starting from block 22,207,815, Arbitrum migrated to Nitro which made Geth
debug_*
methods available for newer blocks.
Use the following methods for calling on blocks prior to 22,207,815:
- arbtrace_block
- arbtrace_call
- arbtrace_callMany
- arbtrace_filter
- arbtrace_get
- arbtrace_replayBlockTransactions
- arbtrace_replayTransaction
- arbtrace_transaction
Get you own node endpoint today
Start for free and get your app to production levels immediately. No credit card required.
You can sign up with your GitHub, X, Google, or Microsoft account.
Pre-built JavaScript-based tracers
Developers can customize the type of tracing using various debug and trace methods, and there are numerous pre-built tracers available to choose from. Here is a list of the pre-built tracers that can be utilized:
4byteTracer
4byteTracer
This tracer looks for function signatures that are 4 bytes long during contract execution and gathers information about the method identifiers and the size of the provided data. This information can be helpful in matching a signature against the data size.
bigramTracer
bigramTracer
This tracer extracts bigram opcodes, which are pairs of adjacent opcodes, which means opcodes executed in sequence one after the other, and can provide insight into the control flow of a contract's execution.
callTracer
callTracer
This tracer extracts information about all internal calls made by a transaction, providing visibility into how contracts interact with each other.
evmdisTracer
evmdisTracer
This tracer returns sufficient information from a trace to perform evmdis-style disassembly, which can be useful for reverse engineering contracts and identifying vulnerabilities.
opcountTracer
opcountTracer
This tracer returns the number of instructions executed by the Ethereum Virtual Machine before the transaction is terminated.
prestateTracer
prestateTracer
This tracer returns sufficient information about an account to create a local execution of the transaction. This procedure runs the given transaction again and monitors every aspect of the state that is modified or accessed during execution.
trigramTracer
trigramTracer
This tracer extracts trigram opcodes, which are sets of three adjacent opcodes, and reports how many times each of these combinations is observed during contract execution.
unigramTracer
unigramTracer
This tracer extracts individual opcodes and returns how many times each opcode was executed, which can be useful for analyzing the behavior of specific instructions in a contract.