# zks_getBlockDetails

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://zksync-mainnet.g.alchemy.com/v2/{apiKey}

Retrieves details for a given block.

Reference: https://www.alchemy.com/docs/chains/zksync/zk-sync-api-endpoints/zks-get-block-details

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Block number | string | Yes | The number of the block. |

## Result

**Block details** (object): Detailed information about the specified block.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "zks_getBlockDetails",
  "params": [
    140599
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "number": 140599,
    "l1BatchNumber": 1617,
    "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"
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://zksync-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "zks_getBlockDetails",
  "params": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'zks_getBlockDetails', params: ['string']})
};

fetch('https://zksync-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://zksync-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "zks_getBlockDetails",
    "params": ["string"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://zksync-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getBlockDetails\",\n  \"params\": [\n    \"string\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://zksync-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getBlockDetails\",\n  \"params\": [\n    \"string\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://zksync-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"zks_getBlockDetails\",\n  \"params\": [\n    \"string\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: zks_getBlockDetails
summary: Retrieves details for a given block.
description: Retrieves details for a given block.
params:
  - name: Block number
    required: true
    description: The number of the block.
    schema:
      title: hex encoded 32-bit unsigned integer
      type: string
      pattern: ^0x[0-9a-fA-F]{1,8}$
result:
  name: Block details
  description: Detailed information about the specified block.
  schema:
    type: object
    title: Block Details
    required:
      - number
      - l1BatchNumber
      - timestamp
      - l1TxCount
      - l2TxCount
      - rootHash
      - status
      - commitTxHash
      - committedAt
      - proveTxHash
      - provenAt
      - executeTxHash
      - executedAt
      - l1GasPrice
      - l2FairGasPrice
      - baseSystemContractsHashes
      - operatorAddress
      - protocolVersion
    properties:
      number:
        type: integer
        description: Number of the block.
      l1BatchNumber:
        type: integer
        description: Corresponding L1 batch number.
      timestamp:
        type: integer
        description: Unix timestamp when the block was committed.
      l1TxCount:
        type: integer
        description: Number of L1 transactions included in the block.
      l2TxCount:
        type: integer
        description: Number of L2 transactions included in the block.
      rootHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Root hash of the block's state after execution.
      status:
        type: string
        description: Current status of the block (e.g., verified, executed).
      commitTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Transaction hash of the commit operation on L1.
      committedAt:
        type: string
        description: Timestamp when the block was committed on L1.
      proveTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Transaction hash of the proof submission on L1.
      provenAt:
        type: string
        description: Timestamp when the proof was submitted on L1.
      executeTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Transaction hash of the execution on L1.
      executedAt:
        type: string
        description: Timestamp when the block execution was completed on L1.
      l1GasPrice:
        type: integer
        description: L1 gas price at the time of the block's execution.
      l2FairGasPrice:
        type: integer
        description: Fair gas price on L2 at the time of the block's execution.
      baseSystemContractsHashes:
        type: object
        properties:
          bootloader:
            title: 32 byte hex value
            type: string
            pattern: ^0x[0-9a-f]{64}$
            description: Hash of the bootloader system contract.
          default_aa:
            title: 32 byte hex value
            type: string
            pattern: ^0x[0-9a-f]{64}$
            description: Hash of the default AA system contract.
      operatorAddress:
        title: hex encoded address
        type: string
        pattern: ^0x[0-9a-fA-F]{40}$
        description: Address of the operator who committed the block.
      protocolVersion:
        type: string
        description: Version of the zkSync protocol the block was committed under.
examples:
  - name: zks_getBlockDetails example
    params:
      - name: Block number
        value: 140599
    result:
      name: Block details
      value:
        number: 140599
        l1BatchNumber: 1617
        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
```
