# ledger_getSequencerCommitmentsOnSlotByHash

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

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

Returns sequencer commitment(s) found in the DA slot identified by its L1 block hash.

Reference: https://www.alchemy.com/docs/chains/citrea/citrea-api-endpoints/ledger-get-sequencer-commitments-on-slot-by-hash

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| hash | string | Yes | 32-byte DA slot hash (hex, without 0x). |

## Result

**Sequencer commitments** (object[]): Array of commitments found at the DA slot hash.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "ledger_getSequencerCommitmentsOnSlotByHash",
  "params": [
    "788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "merkleRoot": "0xd6dc3eb1a59be7bc1ece68318f82a60919f0f98d8c648337d588ce243a17f473",
      "index": "0xba5",
      "l2EndBlockNumber": "0xb7a20b"
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

fetch('https://citrea-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://citrea-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "ledger_getSequencerCommitmentsOnSlotByHash",
    "params": ["788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000"]
}
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://citrea-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"ledger_getSequencerCommitmentsOnSlotByHash\",\n  \"params\": [\n    \"788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000\"\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://citrea-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"ledger_getSequencerCommitmentsOnSlotByHash\",\n  \"params\": [\n    \"788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://citrea-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\": \"ledger_getSequencerCommitmentsOnSlotByHash\",\n  \"params\": [\n    \"788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: ledger_getSequencerCommitmentsOnSlotByHash
description: Returns sequencer commitment(s) found in the DA slot identified by its L1 block hash.
params:
  - name: hash
    required: true
    description: 32-byte DA slot hash (hex, without 0x).
    schema:
      title: DASlotHash
      type: string
      pattern: ^[0-9a-fA-F]{64}$
result:
  name: Sequencer commitments
  description: Array of commitments found at the DA slot hash.
  schema:
    type: array
    items:
      type: object
      required:
        - merkleRoot
        - index
        - l2EndBlockNumber
      additionalProperties: false
      properties:
        merkleRoot:
          title: 32 byte hex value
          type: string
          pattern: ^0x[0-9a-f]{64}$
          description: Merkle root of sequencer commitment.
        index:
          title: hex encoded unsigned integer
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          description: Global commitment index (hex quantity).
        l2EndBlockNumber:
          title: hex encoded unsigned integer
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          description: Last L2 block included in this commitment (hex quantity).
examples:
  - name: ledger_getSequencerCommitmentsOnSlotByHash example
    params:
      - name: hash
        value: 788636f732f490c5072582c7dcde85e34d737c8a4d98e792a59c9d0100000000
    result:
      name: Sequencer commitments
      value:
        - merkleRoot: '0xd6dc3eb1a59be7bc1ece68318f82a60919f0f98d8c648337d588ce243a17f473'
          index: '0xba5'
          l2EndBlockNumber: '0xb7a20b'
```
