For the complete documentation index, see llms.txt. This page is also available as Markdown.

debug_traceBlockBynumber - zkSync

Example code for the debug_traceBlockByHash JSON-RPC method. Сomplete guide on how to use debug_traceBlockByHash JSON-RPC in GetBlock.io Web3 documentation.

Traces the execution of all transactions within a block specified by number. Returns an array of trace results, one per transaction.

Parameters

Parameter
Type
Required
Description

blockParameter

string

Yes

Block number in hex or block tag

options

object

No

Optional tracer options

Request Example

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "debug_traceBlockByNumber",
    "params": [
        "latest",
        {
            "tracer": "callTracer",
            "timeout": "120s"
        }
    ],
    "id": "getblock.io"
}'
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "debug_traceBlockByNumber",
    "params": [
        "latest",
        {
            "tracer": "callTracer",
            "timeout": "120s"
        }
    ],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data, null, 2)))
    .catch(error => console.log(error));

Response Example

Response Parameters

Field
Type
Description

result

array of object

Per-transaction trace results

result[].result

object

Trace object for one transaction

Use Cases

  • Backfilling traces for historical analytics

  • Block-by-block forensic indexing

  • Replaying recent blocks for monitoring tools

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?