# archive_getReceiptProof

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

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

Returns a `ZoneReceiptsProof` for the receipts at the given transaction indexes of an Interop Zone block, proven against a followed beacon height.

Use a beacon height at or after the block's `settledAt` value from [`zone_getCommit`](/docs/chains/zero/zero-api-endpoints/zone-get-commit). If the beacon height has been pruned, the "invalid params" error's `data.firstRetained` is the oldest height still held. If the receipt isn't available at that beacon height, the `-32002` error's `data.settledHeight` is the zone's settled height.

Reference: https://www.alchemy.com/docs/chains/zero/zero-api-endpoints/archive-get-receipt-proof

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Beacon height | string | Yes | The beacon chain height to prove against, as a hex-encoded quantity. Must be at or after the block's `settledAt` beacon height. |
| Block number | string | Yes | The zone block number, as a hex-encoded quantity. |
| Transaction index | string | Yes | The index of the first transaction to prove, as a hex-encoded quantity. |
| Count | string | No | The number of receipts to include, starting at the transaction index, as a hex-encoded quantity. When omitted, the proof covers only the receipt at the transaction index. |

## Result

**Zone receipts proof** (object): The receipts and the proof data linking them to the beacon height.

## Code Examples

### cURL

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

### JavaScript

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

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "archive_getReceiptProof",
    "params": ["string", "string", "string", "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://zerointerop-mainnet.g.alchemy.com/v2/docs-demo"

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

### C#

```csharp
using RestSharp;


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

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

```


## OpenRPC Method Specification

```yaml
name: archive_getReceiptProof
summary: Returns a receipt inclusion proof for transactions in a zone block at a followed beacon height.
description: |-
  Returns a `ZoneReceiptsProof` for the receipts at the given transaction indexes of an Interop Zone block, proven against a followed beacon height.

  Use a beacon height at or after the block's `settledAt` value from [`zone_getCommit`](/docs/chains/zero/zero-api-endpoints/zone-get-commit). If the beacon height has been pruned, the "invalid params" error's `data.firstRetained` is the oldest height still held. If the receipt isn't available at that beacon height, the `-32002` error's `data.settledHeight` is the zone's settled height.
x-compute-units: 20
params:
  - name: Beacon height
    required: true
    description: The beacon chain height to prove against, as a hex-encoded quantity. Must be at or after the block's `settledAt` beacon height.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  - name: Block number
    required: true
    description: The zone block number, as a hex-encoded quantity.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  - name: Transaction index
    required: true
    description: The index of the first transaction to prove, as a hex-encoded quantity.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  - name: Count
    required: false
    description: The number of receipts to include, starting at the transaction index, as a hex-encoded quantity. When omitted, the proof covers only the receipt at the transaction index.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
result:
  name: Zone receipts proof
  description: The receipts and the proof data linking them to the beacon height.
  schema:
    title: ZoneReceiptsProof
    type: object
    required:
      - beaconHeight
      - blockNumber
      - settledHeight
      - roots
      - receipts
      - witness
    properties:
      beaconHeight:
        title: Beacon height
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        description: The beacon height the proof is anchored to.
      blockNumber:
        title: Block number
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        description: The zone block number.
      settledHeight:
        title: Settled height
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        description: The zone's settled height at the beacon height.
      roots:
        title: Roots
        description: The roots the proof commits to.
        type: object
        required:
          - world
          - airlock
          - receipts
        properties:
          world:
            title: World root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          airlock:
            title: Airlock root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          receipts:
            title: Receipts root
            type: string
            pattern: ^0x[0-9a-f]{64}$
      receipts:
        title: Receipts
        description: The proven receipts, one per requested transaction index.
        type: array
        items:
          title: Proven receipt
          type: object
          required:
            - transactionIndex
            - transactionHash
            - firstLogIndex
            - receipt
          properties:
            transactionIndex:
              title: Transaction index
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
              description: The index of the transaction in the zone block.
            transactionHash:
              title: Transaction hash
              description: The hash of the transaction.
              type: string
              pattern: ^0x[0-9a-f]{64}$
            firstLogIndex:
              title: First log index
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
              description: The block-level index of the receipt's first log.
            receipt:
              title: Receipt
              description: The RLP-encoded receipt, as hex.
              type: string
              pattern: ^0x[0-9a-f]*$
      witness:
        title: Witness
        description: The proof witness, as hex-encoded bytes.
        type: string
        pattern: ^0x[0-9a-f]*$
errors:
  - code: -32602
    message: Invalid params, or the beacon height has been pruned
  - code: -32002
    message: The receipt isn't available at this beacon height
  - code: -32000
    message: Read failure or timeout
```
