Skip to main content

[Trace] debug_traceTransaction

The traceTransaction debugging method will attempt to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it will finally attempt to execute the transaction that corresponds to the given hash.

JSONRPC: debug_traceTransaction

Request

Body

    params

    undefined[]

  • Array [

  • TxHash TxHash (string)

    The hash of the transaction.

    TracingOptions

    object

    disableStorage boolean

    Setting this to true will disable storage capture in the null (structLog) tracer (default: false).

    disableMemory boolean

    Setting this to true will disable memory capture in the null (structLog) tracer (default: false).

    disableStack boolean

    Setting this to true will disable stack capture in the null (structLog) tracer (default: false).

    timeout string

    Overrides the default timeout of 5 seconds for trace-enabled EVM execution. A duration string can be anything that is accepted by Go time.ParseDuration function such as "10s" or "300ms".

    tracer string

    Possible values: [null, 4byteTracer, callTracer, fastCallTracer, evmdisTracer, noopTracer, opcountTracer, prestateTracer, revertTracer, unigramTracer, bigramTracer, trigramTracer, custom javascript tracer code]

    If this field is empty or null, then the structLog tracer is used where the execution of every opcode is shown in detail. This null tracer is extremely heavy and usually too verbose for any debugging purpose, so it is advised to use other predefined tracers. This field can be the name of one of the predefined tracers shown below.

    Tracer NameDescription
    4byteTracertraces 4-byte solidity function signatures.
    callTracera slow version of fastCallTracer. It is deprecated in favor of fastCallTracer.
    fastCallTracertraces internal contract calls, gas usage, and call results.
    evmdisTracerreturns information needed to perform evmdis-style disassembly.
    noopTraceris a template tracer that does nothing.
    opcountTraceris a sample tracer that counts the executed opcode.
    prestateTracerreturns information needed to construct a custom local genesis state that this transaction can run on.
    revertTracerreturns the revert reason, or an empty string if the transaction has not reverted.
    unigramTracercounts the occurrence of each opcode.
    bigramTracercounts the occurrence of two consecutive opcodes.
    trigramTracercounts the occurrence of three consecutive opcodes.

    Otherwise this field is interpreted as a piece of javascript code. You can find more about custom JS tracer here and here. Below is an example custom tracer that prints the gasUsed after each opcode "{gasUsed: [], step: function(log) { this.gasUsed.push(log.getGas()); }, result: function() { return this.gasUsed; }, fault: function() {}}". Note that some nodes with --rpc.unsafe-debug.disable option will prohibit custom tracer.

  • ]

Responses

The structured logs created during the execution of KLVM.

Schema

    error

    object

    code int64required

    A Number that indicates the error type that occurred. This MUST be an integer.

    codemessagedescription
    -32700Parse errorinvalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
    -32602Invalid paramsInvalid method parameter(s).
    message string

    A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.

    data string

    A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).

    result

    object

    The structured logs created during the execution of KLVM.

    failed booleanrequired
    gas integerrequired
    returnValue stringrequired

    structLogs

    object[]

    required

  • Array [

  • computation number
    computationCost number
    depth number
    gas number
    gasCost number
    memory string[]
    op string
    pc number
    stack string[]

    The status of the response

    storage object

    The status of the response

  • ]

Loading...