# ledger_getLastVerifiedBatchProof

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

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

Returns the most recent verified batch proof.

Reference: https://www.alchemy.com/docs/chains/citrea/citrea-api-endpoints/ledger-get-last-verified-batch-proof

## Result

**Verified batch proof** (object): Latest verified batch proof (same structure as an item from ledger_getVerifiedBatchProofsBySlotHeight).

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "proof": "0x0300000000000000000000000000000081670c116a84c0351f18c3...",
    "proofOutput": {
      "stateRoots": [
        "0x5e2a5b8da99b65c5eba4b36f2368321dad95c08c641d698b09ca6756caac589e",
        "0x182a9543bf64a90e78f7d810dedebdf4da3322752db5ee5533fae564e31033f7"
      ],
      "finalL2BlockHash": "0x8fe769cdb2d34f60b5a625caa8697ae1d1f213b558c9dc9e681059f18732e608",
      "stateDiff": {
        "0x412f612f0201edff3b3ee593dbef54e2fbdd421070db55e2de2aebe75f398bd85ac97ed364": "0xf4fd64e249e658fdb748f83190e47f0b1cd5e87fe30d005c257d7a94cca458e7167e690000000000"
      },
      "lastL2Height": "0xae0e97",
      "sequencerCommitmentIndexRange": [
        "0x92c",
        "0x92e"
      ],
      "sequencerCommitmentHashes": [
        "0x8a9cd0b9fda255370073abff4176416665d14552d5f0d671998ca89523041b36"
      ],
      "lastL1HashOnBitcoinLightClientContract": "0xa1717b35aa14be01ce037d1a346c4c1714afcfa5e8a66a35af5ead0000000000",
      "previousCommitmentIndex": "0x92b",
      "previousCommitmentHash": "0xa37a45539d40448d22f6da7978ca58f5845b72a5043129941817099471198749"
    }
  },
  "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_getLastVerifiedBatchProof"
}'
```

### JavaScript

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

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_getLastVerifiedBatchProof"
}
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_getLastVerifiedBatchProof\"\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_getLastVerifiedBatchProof\"\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_getLastVerifiedBatchProof\"\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: ledger_getLastVerifiedBatchProof
description: Returns the most recent verified batch proof.
params: []
result:
  name: Verified batch proof
  description: Latest verified batch proof (same structure as an item from ledger_getVerifiedBatchProofsBySlotHeight).
  schema:
    type: object
    required:
      - proof
      - proofOutput
    additionalProperties: false
    properties:
      proof:
        title: hex encoded bytes
        type: string
        pattern: ^0x[0-9a-f]*$
        description: ZK proof data (~2MB, hex-encoded).
      proofOutput:
        type: object
        required:
          - stateRoots
          - finalL2BlockHash
          - stateDiff
          - lastL2Height
          - sequencerCommitmentIndexRange
          - sequencerCommitmentHashes
          - lastL1HashOnBitcoinLightClientContract
          - previousCommitmentIndex
          - previousCommitmentHash
        additionalProperties: false
        properties:
          stateRoots:
            type: array
            minItems: 1
            items:
              title: 32 byte hex value
              type: string
              pattern: ^0x[0-9a-f]{64}$
          finalL2BlockHash:
            title: 32 byte hex value
            type: string
            pattern: ^0x[0-9a-f]{64}$
          stateDiff:
            type: object
            additionalProperties:
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
          lastL2Height:
            title: hex encoded unsigned integer
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          sequencerCommitmentIndexRange:
            type: array
            minItems: 2
            maxItems: 2
            items:
              title: hex encoded unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          sequencerCommitmentHashes:
            type: array
            minItems: 1
            items:
              title: 32 byte hex value
              type: string
              pattern: ^0x[0-9a-f]{64}$
          lastL1HashOnBitcoinLightClientContract:
            title: 32 byte hex value
            type: string
            pattern: ^0x[0-9a-f]{64}$
          previousCommitmentIndex:
            title: hex encoded unsigned integer
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          previousCommitmentHash:
            title: 32 byte hex value
            type: string
            pattern: ^0x[0-9a-f]{64}$
examples:
  - name: ledger_getLastVerifiedBatchProof example
    params: []
    result:
      name: Verified batch proof
      value:
        proof: 0x0300000000000000000000000000000081670c116a84c0351f18c3...
        proofOutput:
          stateRoots:
            - '0x5e2a5b8da99b65c5eba4b36f2368321dad95c08c641d698b09ca6756caac589e'
            - '0x182a9543bf64a90e78f7d810dedebdf4da3322752db5ee5533fae564e31033f7'
          finalL2BlockHash: '0x8fe769cdb2d34f60b5a625caa8697ae1d1f213b558c9dc9e681059f18732e608'
          stateDiff:
            '0x412f612f0201edff3b3ee593dbef54e2fbdd421070db55e2de2aebe75f398bd85ac97ed364': '0xf4fd64e249e658fdb748f83190e47f0b1cd5e87fe30d005c257d7a94cca458e7167e690000000000'
          lastL2Height: '0xae0e97'
          sequencerCommitmentIndexRange:
            - '0x92c'
            - '0x92e'
          sequencerCommitmentHashes:
            - '0x8a9cd0b9fda255370073abff4176416665d14552d5f0d671998ca89523041b36'
          lastL1HashOnBitcoinLightClientContract: '0xa1717b35aa14be01ce037d1a346c4c1714afcfa5e8a66a35af5ead0000000000'
          previousCommitmentIndex: '0x92b'
          previousCommitmentHash: '0xa37a45539d40448d22f6da7978ca58f5845b72a5043129941817099471198749'
```
