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

zks_getBlockDetails - zkSync

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

Returns zkSync-specific details for an L2 block: status (verified/proven/committed/executed), corresponding L1 batch, operator address, protocol version, and gas prices.

Parameters

Parameter
Type
Required
Description

blockNumber

integer

Yes

The L2 block number to query

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": "zks_getBlockDetails",
    "params": [
        2247607
    ],
    "id": "getblock.io"
}'
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "zks_getBlockDetails",
    "params": [
        2247607
    ],
    "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

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "number": 2247607,
        "l1BatchNumber": 468355,
        "timestamp": 1679815038,
        "l1TxCount": 0,
        "l2TxCount": 20,
        "rootHash": "0xf1adac176fc939313eea4b72055db0622a10bbd9b7a83097286e84e471d2e7df",
        "status": "verified",
        "commitTxHash": "0xd045e3698f018cb233c3817eb53a41a4c5b28784ffe659da246aa33bda34350c",
        "committedAt": "2023-03-26T07:21:21.046817Z",
        "proveTxHash": "0x1591e9b16ff6eb029cc865614094b2e6dd872c8be40b15cc56164941ed723a1a",
        "provenAt": "2023-03-26T19:48:35.200565Z",
        "executeTxHash": "0xbb66aa75f437bb4255cf751badfc6b142e8d4d3a4e531c7b2e737a22870ff19e",
        "executedAt": "2023-03-27T07:44:52.187764Z",
        "l1GasPrice": 20690385511,
        "l2FairGasPrice": 250000000,
        "baseSystemContractsHashes": {
            "bootloader": "0x010007793a328ef16cc7086708f7f3292ff9b5eed9e7e539c184228f461bf4ef",
            "default_aa": "0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc"
        },
        "operatorAddress": "0xfeee860e7aae671124e9a4e61139f3a5085dfeee",
        "protocolVersion": "Version5"
    }
}

Response Parameters

Field
Type
Description

result.number

integer

L2 block number

result.l1BatchNumber

integer

Corresponding L1 batch number

result.timestamp

integer

Unix timestamp when the block was committed

result.status

string

Block status — committed, proven, executed, verified

result.commitTxHash

string

L1 transaction hash of the commit operation

result.proveTxHash

string

L1 transaction hash of the proof submission

result.executeTxHash

string

L1 transaction hash of the execution

result.operatorAddress

string

Address of the operator who committed the block

result.protocolVersion

string

zkSync protocol version this block was committed under

Use Cases

  • Explorers showing block-to-L1-batch mapping

  • Auditing block finality on Ethereum mainnet

  • Computing per-block settlement latency

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?