Skip to content

Debug RPCs

Wei Tang edited this page Oct 2, 2017 · 2 revisions

debug_dumpBlock

Retrieves the state that corresponds to the block number and returns a list of accounts (including storage and code).

{"method": "debug_dumpBlock", "params": [number]}

Example Response

{
  accounts: {
    fff7ac99c8e4feb60c9750054bdc14ce1857f181: {
      balance: "49358640978154672",
      code: "",
      codeHash: "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
      nonce: 2,
      root: "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      storage: {}
    },
    fffbca3a38c3c5fcb3adbb8e63c04c3e629aafce: {
      balance: "3460945928",
      code: "",
      codeHash: "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
      nonce: 657,
      root: "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      storage: {}
    }
  },
  root: "19f4ed94e188dd9c7eb04226bd240fa6b449401a6c656d6d2816a87ccaf206f1"
}

debug_getBlockRlp

Retrieves and returns the RLP encoded block by number.

{"method": "debug_getBlockRlp", "params": [number]}

debug_traceBlock

The traceBlock method will return a full stack trace of all invoked opcodes of all transaction that were included included in this block. Note, the parent of this block must be present or it will fail.

{"method": "debug_traceBlock", "params": [blockRlp, {}]}

The second parameter is a trace configuration and is set with default value:

{
    disable_memory: false,
    disable_stack: false,
    disable_storage: false,
}

#### Example Response

{ structLogs: [{ depth: 1, error: "", gas: 162106, gasCost: 3, memory: null, op: 1, pc: 0, stack: [], storage: {} }, { depth: 1, error: "", gas: 100000, gasCost: 0, memory: ["0000000000000000000000000000000000000000000000000000000000000006", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000060"], op: 44, pc: 120, stack: ["00000000000000000000000000000000000000000000000000000000d67cbec9"], storage: { 0000000000000000000000000000000000000000000000000000000000000004: "8241fa522772837f0d05511f20caa6da1d5a3209000000000000000400000001", 0000000000000000000000000000000000000000000000000000000000000006: "0000000000000000000000000000000000000000000000000000000000000001", f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f: "00000000000000000000000002e816afc1b5c0f39852131959d946eb3b07b5ad" } }] }


### `debug_traceBlockByNumber`

Similar to debug_traceBlock, traceBlockByNumber accepts a block number and will replay the block that is already present in the database.

{"method": "debug_traceBlockByNumber", "params": [number, {}]}


### `debug_traceBlockByHash`

Similar to debug_traceBlock, traceBlockByHash accepts a block hash and will replay the block that is already present in the database.

{"method": "debug_traceBlockByHash", "params": [hash, {}]}


### `debug_traceBlockFromFile`

Similar to debug_traceBlock, traceBlockFromFile accepts a file containing the RLP of the block.

{"method": "debug_traceBlockFromFile", "params": [fileName, {}]}


### `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.

The second argument has its default values same as `debug_traceBlock`.

{"method": "debug_traceTransaction", "params": [txHash, {}]}


#### Example Response

{ gas: 85301, returnValue: "", structLogs: [{ depth: 1, error: "", gas: 162106, gasCost: 3, memory: null, op: 1, pc: 0, stack: [], storage: {} }, { depth: 1, error: "", gas: 100000, gasCost: 0, memory: ["0000000000000000000000000000000000000000000000000000000000000006", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000060"], op: 44, pc: 120, stack: ["00000000000000000000000000000000000000000000000000000000d67cbec9"], storage: { 0000000000000000000000000000000000000000000000000000000000000004: "8241fa522772837f0d05511f20caa6da1d5a3209000000000000000400000001", 0000000000000000000000000000000000000000000000000000000000000006: "0000000000000000000000000000000000000000000000000000000000000001", f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f: "00000000000000000000000002e816afc1b5c0f39852131959d946eb3b07b5ad" } }] }

Clone this wiki locally