Debug

Debug methods

To enable the debug route namespace, you need to modify the configuration and add the "debug" parameter as shown below:

[jsonrpc.http]
    enabled = true
    port = 10001
    host = "0.0.0.0"
    api = ["eth", "net", "web3", "txpool", "bor", "debug"]

debug_traceBlockByNumber

Executes all transactions in the block specified by number with a tracer and returns the tracing result.

Parameters

  • QUANTITY|TAG - integer of a block number, or the string "latest"

  • Object - The tracer options:

    • enableMemory: Boolean - (optional, default: false) The flag indicating enabling memory capture.

    • disableStack: Boolean - (optional, default: false) The flag indicating disabling stack capture.

    • disableStorage: Boolean - (optional, default: false) The flag indicating disabling storage capture.

    • enableReturnData: Boolean - (optional, default: false) The flag indicating enabling return data capture.

    • timeOut: String - (optional, default: "5s") The timeout for cancellation of execution.

Returns

Array - Array of trace objects with the following fields:

  • failed: Boolean - the tx is successful or not

  • gas: QUANTITY - the total consumed gas in the tx

  • returnValue: DATA - the return value of the executed contract call

  • structLogs: Array - the trace result of each step with the following fields:

    • pc: QUANTITY - the current index in bytecode

    • op: String - the name of current executing operation

    • gas: QUANTITY - the available gas ßin the execution

    • gasCost: QUANTITY - the gas cost of the operation

    • depth: QUANTITY - the number of levels of calling functions

    • error: String - the error of the execution

    • stack: Array - array of values in the current stack

    • memory: Array - array of values in the current memory

    • storage: Object - mapping of the current storage

    • refund: QUANTITY - the total of current refund value

Example

curl  https://node1-mainnet.maalscan.io -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlockByNumber","params":["latest"],"id":1}'

debug_traceBlockByHash

Executes all transactions in the block specified by block hash with a tracer and returns the tracing result.

Parameters

  • DATA , 32 Bytes - Hash of a block.

  • Object - The tracer options. See debug_traceBlockByNumber for more details.

Returns

Array - Array of trace objects. See debug_traceBlockByNumber for more details.

Example

curl  https://node1-mainnet.maalscan.io -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlockByHash","params":["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae"],"id":1}'

debug_traceBlock

Executes all transactions in the block given from the first argument with a tracer and returns the tracing result.

Parameters

  • DATA - RLP Encoded block bytes

  • Object - The tracer options. See debug_traceBlockByNumber for more details.

Returns

Array - Array of trace objects. See debug_traceBlockByNumber for more details.

Example

curl  https://node1-mainnet.maalscan.io -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceBlock","params":["0xf9...."],"id":1}'

debug_traceTransaction

Executes the transaction specified by transaction hash with a tracer and returns the tracing result.

Parameters

  • DATA , 32 Bytes - Hash of a transaction.

  • Object - The tracer options. See debug_traceBlockByNumber for more details.

Returns

Object - Trace object. See debug_traceBlockByNumber for more details.

Example

curl  https://node1-mainnet.maalscan.io -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae"],"id":1}'

debug_traceCall

Executes a new message call with a tracer and returns the tracing result.

Parameters

  • Object - The transaction call object

    • from: DATA, 20 Bytes - (optional) The address the transaction is sent from.

    • to: DATA, 20 Bytes - The address the transaction is directed to.

    • gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.

    • gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas

    • value: QUANTITY - (optional) Integer of the value sent with this transaction

    • data: DATA - (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation

  • QUANTITY|TAG - integer block number, or the string "latest"

  • Object - The tracer options. See debug_traceBlockByNumber for more details.

Returns

Object - Trace object. See debug_traceBlockByNumber for more details.

Example

curl  https://node1-mainnet.maalscan.io -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_traceCall","params":[{"to": "0x1234", "data": "0x1234"}, "latest", {}],"id":1}'

Last updated