# linea_getProof

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

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

Returns the account and optionally storage values of the specified account, including the Merkle proof. This method is similar to eth_getProof and follows the same format.


Reference: https://www.alchemy.com/docs/chains/linea/linea-api-endpoints/linea-get-proof

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| address | string | Yes | The address of the account. |
| storageKeys | string[] | Yes | An array of storage keys to generate proofs for. |
| blockNumber | string or enum | Yes | The block number or tag at which to get the proof. |

## Result

**Account proof** (object): The account and storage proof data.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "linea_getProof",
  "params": [
    "0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842",
    [
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ],
    "latest"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "address": "0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842",
    "accountProof": [
      "0xf90211a...0029"
    ],
    "balance": "0x0",
    "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
    "nonce": "0x0",
    "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "storageProof": [
      {
        "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "value": "0x0",
        "proof": [
          "0xf90211a...0029"
        ]
      }
    ]
  },
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "linea_getProof",
    "params": ["0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842", ["0x0000000000000000000000000000000000000000000000000000000000000000"], "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://linea-mainnet.g.alchemy.com/v2/docs-demo"

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

### C#

```csharp
using RestSharp;


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

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

```


## OpenRPC Method Specification

```yaml
name: linea_getProof
summary: Get Merkle proof for an account and optionally storage keys
description: |
  Returns the account and optionally storage values of the specified account, including the Merkle proof. This method is similar to eth_getProof and follows the same format.
params:
  - name: address
    required: true
    description: The address of the account.
    schema:
      title: hex encoded address
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
  - name: storageKeys
    required: true
    description: An array of storage keys to generate proofs for.
    schema:
      type: array
      items:
        title: 32 hex encoded bytes
        type: string
        pattern: ^0x[0-9a-f]{64}$
  - name: blockNumber
    required: true
    description: The block number or tag at which to get the proof.
    schema:
      title: Block number or tag
      oneOf:
        - title: Block number
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        - title: Block tag
          type: string
          enum:
            - earliest
            - finalized
            - safe
            - latest
            - pending
          description: '`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error'
result:
  name: Account proof
  description: The account and storage proof data.
  schema:
    type: object
    properties:
      address:
        title: hex encoded address
        type: string
        pattern: ^0x[0-9a-fA-F]{40}$
      accountProof:
        type: array
        description: Array of RLP-encoded Merkle tree nodes for the account trie.
        items:
          type: string
      balance:
        title: hex encoded 256 bit unsigned integer
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
      codeHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
      nonce:
        title: hex encoded unsigned integer
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
      storageHash:
        title: 32 byte hex value
        type: string
        pattern: ^0x[0-9a-f]{64}$
      storageProof:
        type: array
        description: Array of storage entry proofs.
        items:
          type: object
          properties:
            key:
              title: 32 hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]{64}$
            value:
              title: hex encoded 256 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
            proof:
              type: array
              items:
                type: string
examples:
  - name: linea_getProof example
    params:
      - name: address
        value: '0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842'
      - name: storageKeys
        value:
          - '0x0000000000000000000000000000000000000000000000000000000000000000'
      - name: blockNumber
        value: latest
    result:
      name: Account proof
      value:
        address: '0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842'
        accountProof:
          - 0xf90211a...0029
        balance: '0x0'
        codeHash: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
        nonce: '0x0'
        storageHash: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
        storageProof:
          - key: '0x0000000000000000000000000000000000000000000000000000000000000000'
            value: '0x0'
            proof:
              - 0xf90211a...0029
```
