> For the complete documentation index, see [llms.txt](https://validium.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://validium.gitbook.io/docs/api-reference/debug-json-rpc-api.md).

# Debug JSON-RPC API

***

### `debug_traceBlockByHash` <a href="#debug_traceblockbyhash" id="debug_traceblockbyhash"></a>

Traces all calls made from a specific block by its L2 hash.

**Parameters**

1. **DATA, 32 bytes** - hash defining the L2 block.
2. **TracerConfig** - Optional configuration for tracing. Refer to the [TraceConfig documentation](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig) for more details.

**Returns**

Array of objects, each representing a traced call made from the specified block.

**Trace Object**

Show properties

**Example Request**

```bash
curl --request POST \
  --url http://testnet.l2.rpc.validium.network/ \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "debug_traceBlockByHash",
      "params": ["0x4bd0bd4547d8f8a4fc86a024e54558e156c1acf43d82e24733c6dac2fe5c5fc7"]
    }'
```

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "type": "Call",
      "from": "0x0000000000000000000000000000000000000000",
      "to": "0x0000000000000000000000000000000000008001",
      "gas": "0x18be25",
      "gasUsed": "0x7603b",
      "value": "0xa1e94fc0fe6043",
      "output": "0x",
      "input": "0x",
      "error": null,
      "revertReason": null,
      "calls": [...]
    },
    ...
  ]
}
```

***

### `debug_traceBlockByNumber` <a href="#debug_traceblockbynumber" id="debug_traceblockbynumber"></a>

Traces all calls made from a specific block by its L2 block number.

**Parameters**

1. **QUANTITY, 8 bytes | TAG** - The number of the block to trace. This can be a hex-encoded number or one of the strings "earliest", "latest", or "pending".
2. **TracerConfig** - Optional configuration for tracing. Refer to the [TraceConfig documentation](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig) for more details.

**Returns**

Array of objects, each representing a traced call made from the specified block.

**Trace Object**

Show properties

**Example Request**

```bash
curl --request POST \
  --url http://testnet.l2.rpc.validium.network/ \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "debug_traceBlockByNumber",
      "params": ["0x24b258"]
    }'
```

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "result": {
      "type": "Call",
      "from": "0x0000000000000000000000000000000000000000",
      "to": "0x0000000000000000000000000000000000008001",
      "gas": "0x18be25",
      "gasUsed": "0x7603b",
      "value": "0xa1e94fc0fe6043",
      "output": "0x",
      "input": "0x",
      "error": null,
      "revertReason": null,
      "calls": [...]
    },
    ...
  ]
}
```

***

### `debug_traceCall` <a href="#debug_tracecall" id="debug_tracecall"></a>

Traces a call made at a specific block, by block number or hash.

**Parameters**

1. **CallRequest** - The call request to trace, containing fields like `from`, `to`, `data`, and optionally `gas`, `gasPrice`, and `value`.
2. **DATA, 32 bytes | QUANTITY, 8 bytes** - Optional. The block identifier, which can be a block number as a hex-encoded number or a block hash. If not specified, the latest block is used.
3. **TracerConfig** - Optional. Configuration options for the trace. For more details, refer to the [TraceConfig documentation](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig).

**Returns**

Array of objects, each representing a traced call made from the specified block.

**Trace Object**

Show properties

**Example Request**

```bash
curl --request POST \
  --url http://testnet.l2.rpc.validium.network/ \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "debug_traceCall",
      "params": [
        {
          "from": "0x1111111111111111111111111111111111111111",
          "to": "0x2222222222222222222222222222222222222222",
          "data": "0xffffffff"
        },
        "0x24b258"
      ]
    }'
```

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "type": "Call",
    "from": "0x0000000000000000000000000000000000000000",
    "to": "0x0000000000000000000000000000000000008001",
    "gas": "0x0",
    "gasUsed": "0x6b4b",
    "value": "0x0",
    "output": "0x",
    "input": "0xffffffff",
    "error": null,
    "revertReason": null,
    "calls": []
  },
  "id": 1
}
```

***

### `debug_traceTransaction` <a href="#debug_tracetransaction" id="debug_tracetransaction"></a>

Uses the [EVM's `callTracer`](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#call-tracer) to return a debug trace of a specific transaction given by its transaction hash.

**Parameters**

1. **DATA, 32 bytes** - The 32-byte hash of the transaction to trace.
2. **TracerConfig** - Optional. Configuration options for the trace. For more details, refer to the [TraceConfig documentation](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#traceconfig).

**Returns**

Array of objects, each representing a traced call made from the specified block.

**Trace Object**

Show properties

**Example Request**

```bash
curl --request POST \
  --url http://testnet.l2.rpc.validium.network/ \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "debug_traceTransaction",
      "params": ["0x4b228f90e796de5a18227072745b0f28e0c4a4661a339f70d3bdde591d3b7f3a"]
    }'
```

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "type": "Call",
      "from": "0x0000000000000000000000000000000000000000",
      "to": "0x0000000000000000000000000000000000008001",
      "gas": "0x154800",
      "gasUsed": "0xc2419",
      "value": "0x0",
      "output": "0x",
      "input": "0x095ea7b30000000000000000000000002da10a1e27bf85cedd8ffb1abbe97e53391c0295ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
      "error": null,
      "revertReason": null,
      "calls": [...]
    },
    ...
  ]
}
```
