# zks_getL1BatchDetails

> 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 L1 batch.

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

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| L1 batch number | string | Yes | L1 batch number. |

## Result

**L1 Batch Details** (object): Detailed information about the specified L1 batch.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "zks_getL1BatchDetails",
  "params": [
    468355
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "number": 468355,
    "timestamp": 1711649164,
    "l1TxCount": 1,
    "l2TxCount": 2363,
    "rootHash": "0x7b31ef880f09238f13b71a0f6bfea340b9c76d01bba0712af6aa0a4f224be167",
    "status": "verified",
    "commitTxHash": "0x5b2598bf1260d498c1c6a05326f7416ef2a602b8a1ac0f75b583cd6e08ae83cb",
    "committedAt": "2024-03-28T18:24:49.713730Z",
    "proveTxHash": "0xc02563331d0a83d634bc4190750e920fc26b57096ec72dd100af2ab037b43912",
    "provenAt": "2024-03-29T03:09:19.634524Z",
    "executeTxHash": "0xbe1ba1fdd17c2421cf2dabe2908fafa26ff4fa2190a7724d16295dd9df72b144",
    "executedAt": "2024-03-29T18:18:04.204270Z",
    "l1GasPrice": 47875552051,
    "l2FairGasPrice": 25000000,
    "baseSystemContractsHashes": {
      "bootloader": "0x010007ede999d096c84553fb514d3d6ca76fbf39789dda76bfeda9f3ae06236e",
      "default_aa": "0x0100055b041eb28aff6e3a6e0f37c31fd053fc9ef142683b05e5f0aee6934066"
    }
  },
  "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_getL1BatchDetails",
  "params": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'zks_getL1BatchDetails', 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_getL1BatchDetails",
    "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_getL1BatchDetails\",\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_getL1BatchDetails\",\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_getL1BatchDetails\",\n  \"params\": [\n    \"string\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: zks_getL1BatchDetails
summary: Retrieves details for a given L1 batch.
description: Retrieves details for a given L1 batch.
params:
  - name: L1 batch number
    required: true
    description: L1 batch number.
    schema:
      title: hex encoded 32-bit unsigned integer
      type: string
      pattern: ^0x[0-9a-fA-F]{1,8}$
result:
  name: L1 Batch Details
  description: Detailed information about the specified L1 batch.
  schema:
    type: object
    title: L1 Batch Details
    required:
      - number
      - timestamp
      - l1TxCount
      - l2TxCount
      - rootHash
      - status
      - commitTxHash
      - committedAt
      - proveTxHash
      - provenAt
      - executeTxHash
      - executedAt
      - l1GasPrice
      - l2FairGasPrice
      - baseSystemContractsHashes
    properties:
      number:
        type: integer
        description: L1 batch number.
      timestamp:
        type: integer
        description: Unix timestamp when the batch was processed.
      l1TxCount:
        type: integer
        description: Number of L1 transactions included in the batch.
      l2TxCount:
        type: integer
        description: Number of L2 transactions associated with this batch.
      rootHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Root hash of the state after processing the batch.
      status:
        type: string
        description: Current status of the batch (e.g., verified).
      commitTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Ethereum transaction hash for the commit operation.
      committedAt:
        type: string
        description: Timestamp when the batch was committed on Ethereum.
      proveTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Ethereum transaction hash for the proof submission.
      provenAt:
        type: string
        description: Timestamp when the proof was submitted.
      executeTxHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
        description: Ethereum transaction hash for the execution.
      executedAt:
        type: string
        description: Timestamp when the execution was completed.
      l1GasPrice:
        type: integer
        description: Gas price on L1 at the time of batch processing.
      l2FairGasPrice:
        type: integer
        description: Fair gas price on L2 at the time of batch processing.
      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.
examples:
  - name: zks_getL1BatchDetails example
    params:
      - name: L1 batch number
        value: 468355
    result:
      name: L1 Batch Details
      value:
        number: 468355
        timestamp: 1711649164
        l1TxCount: 1
        l2TxCount: 2363
        rootHash: '0x7b31ef880f09238f13b71a0f6bfea340b9c76d01bba0712af6aa0a4f224be167'
        status: verified
        commitTxHash: '0x5b2598bf1260d498c1c6a05326f7416ef2a602b8a1ac0f75b583cd6e08ae83cb'
        committedAt: '2024-03-28T18:24:49.713730Z'
        proveTxHash: '0xc02563331d0a83d634bc4190750e920fc26b57096ec72dd100af2ab037b43912'
        provenAt: '2024-03-29T03:09:19.634524Z'
        executeTxHash: '0xbe1ba1fdd17c2421cf2dabe2908fafa26ff4fa2190a7724d16295dd9df72b144'
        executedAt: '2024-03-29T18:18:04.204270Z'
        l1GasPrice: 47875552051
        l2FairGasPrice: 25000000
        baseSystemContractsHashes:
          bootloader: '0x010007ede999d096c84553fb514d3d6ca76fbf39789dda76bfeda9f3ae06236e'
          default_aa: '0x0100055b041eb28aff6e3a6e0f37c31fd053fc9ef142683b05e5f0aee6934066'
```
