# Getting the Storage Proof

First we need to fetch the **storage proof** from **Optimism** using the block number of a Optimism block which header that has already been propagated to Hashi. This block number ensures that Hashi can verify the proof against the just mentioned block header propagated to **Gnosis Chain**.

#### **Fetching the Proof**

Use the following `curl` command or javascript script to fetch the **account and storage proof** for the **USDC total supply** on **Optimism**:

{% tabs %}
{% tab title="Curl" %}

```javascript
curl --location --request POST 'https://jsonrpc.hashi-explorer.xyz/v1' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "hashi_getAccountAndStorageProof",
  "params": {
      "chainId": 10,
      "address": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
      "storageKeys": ["0x00000000000000000000000000000000000000000000000000000000000000b"],
      "blockNumber": 126086800
  }
}'
```

{% endtab %}

{% tab title="Javascript" %}

```python
import axios from "axios";

const main = async () => {

  // fetch storage proof from Hashi Prover
  console.log("Fetching storage proof from Hashi prover...");
  const result = await axios.post(
    "http://jsonrpc.hashi-explorer.xyz:3000/v1",
    {
      jsonrpc: "2.0",
      method: "hashi_getAccountAndStorageProof",
      params: {
          chainId: 10,
          address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
          storageKeys: ["0x00000000000000000000000000000000000000000000000000000000000000b"],
          blockNumber: 126086800
      },
      id: 1,
    },
    {
      headers: {
        "Content-Type": "application/json",
      },
    }
  );
  console.log("Storage proof result", result.data.result.proof);
};

main();
```

{% endtab %}
{% endtabs %}

* **chainId**: 10 (Optimism).
* **address**: The address of the USDC contract on Optimism: `0x0b2c639c533813f4aa9d7837caf62653d097ff85`.
* **storageKeys**: The storage key for the USDC total supply: `0xb`.
* **blockNumber**: The block number on Optimism, **126086800**, which must have already been propagated to **Gnosis Chain** via Hashi for the proof to be valid.

This `curl` command returns the account and storage proof for the USDC total supply, which will be used for verification on **Gnosis Chain**.

#### Use the SP1 storage proof  generator

Hashi support [SP1 zkVM to generate storage proofs](/hashi/tools/sp1-storage-proof-verifier.md).

```
RUST_LOG=info cargo run --release -- --execute \
    --rpc-url https://mainnet.infura.io/v3/YOUR-PROJECT-ID \
    --reference-block-number 0x7B60EA3 \
    --proof-block-number 0x783EE90 \
    --account 0x0b2c639c533813f4aa9d7837caf62653d097ff85 \
    --storage-key 0x000000000000000000000000000000000000000000000000000000000000000b
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://crosschain-alliance.gitbook.io/hashi/getting-started/quick-start/reading-foreign-state/getting-the-storage-proof.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
