> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getAssetProof

> Get the Merkle proof needed to transfer, burn or update a Solana compressed NFT with DAS getAssetProof on OrbitFlare.

## Overview

Compressed NFTs live as leaves in a concurrent Merkle tree, not in their own accounts. To transfer, burn, delegate or update one, the transaction must prove the leaf is in the tree. `getAssetProof` returns that proof: the current root, the sibling hashes from the leaf up to the root, and the leaf hash.

<Tip>
  If you also need the asset itself (for owner, delegate and hashes), use [getAssetWithProof](/das-api/methods/getAssetWithProof) to get both in one call.
</Tip>

## Parameters

<ResponseField name="id" type="string" required>
  The compressed asset ID (base-58).
</ResponseField>

## Response

<ResponseField name="result" type="object">
  <Expandable title="proof fields">
    <ResponseField name="root" type="string">
      Current root of the Merkle tree.
    </ResponseField>

    <ResponseField name="proof" type="string[]">
      Sibling node hashes from the leaf up to the root.
    </ResponseField>

    <ResponseField name="node_index" type="number">
      Index of the leaf's node in the tree.
    </ResponseField>

    <ResponseField name="leaf" type="string">
      Hash of the leaf.
    </ResponseField>

    <ResponseField name="tree_id" type="string">
      Merkle tree address.
    </ResponseField>

    <ResponseField name="last_indexed_slot" type="number">
      Most recent slot the index has processed.
    </ResponseField>
  </Expandable>
</ResponseField>

## Code Examples

### Request

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAssetProof",
  "params": {
    "id": "JEKNNLZK6uQaQUEUz9GRoYZ7buHQ4rTN6k3qhX9NG8qU"
  }
}'
```

### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
{
  "jsonrpc": "2.0",
  "result": {
    "last_indexed_slot": 457714576,
    "root": "3wxyaNRvzuZqDd9jtqthCu87spdKuhcpaKVzP1msGyHW",
    "proof": [
      "8mjbWMPrBwYJeEmQbeYLR7mscS4umW4U3kxibuH8hcY1",
      "DV31TLc5BXCnCQMaQ9H6empbG9i69w4AWkjR5RPiyXr8",
      "G6f1pEKetujNm6JXQxD47eBudxLV1irR1U5atpAXBb4q",
      "FbztVPKvuxh5SKvgwnnfahS1cX1pNCkDwdGWXjiS6uMr",
      "4o3C635ciZfE3DhDbJd3SUi4NziqsTe4qUMYpUycEPnD",
      "7wYFA3aSJzJiUQeLX8W3z8n6kj38MvXjS4THiR8EqXaX",
      "ySuYMGpCfwSaPCSekQ7GqzPwK2tNFQRiXzpMBk87y2G",
      "4cEUgjcHgRLHaTb8W3b8zepKd5mEM2YSjUaE1SUVtp9E",
      "AUaRHd35EJPV6WVzgfDease3DUQzYRGnDM72kPNJMxxY",
      "BXmjgYrVGcypzZToQkC4YzAKTfKJDkUbwR5zzLXzYZyv",
      "H2Z3JbU8P1hyNKZErvmhfJVwsQBbQuNrJqXkZb6hL1Ct",
      "8mRjuEbofX63HUHfRrScqKMWuTYJsjeGPDAz7tWPqP45",
      "4BCzbM5wTzy3nCNQ7Sd8px1w4pBwse2VZksZVeVgGN5D",
      "6d4JjgVgErnnBLjzLSQcuAJEc9fUhTbDNRXihjuhPpJ3",
      "8AhhfYKmRs8srSsp9BeWTrjkTUrXh5UDu17C1ApueuD4",
      "6eQoNu6H4dDsRgdJFFMKAFuAiYDRLDwrza52gn9W8pX2",
      "AWnzWhtFyRdQTVmd3NwNNXEJuSzcu33L73RXJgukaEnM",
      "BViAqVspYKdhqYKqVpntUmspSBSWqibm6LjWdvP2F2Vj",
      "BMkvaTguMUzPD4SEr2EQ2j15mrnucrKnUzrVHyMpDbw2",
      "EdGUXNZE4FDSYtKY7SDYAam2a7atkGAmezhGFnfauiA9"
    ],
    "node_index": 1671570,
    "leaf": "CcMhrzXFkjyLwZdijjRibgSYw4tUzXYALoCxwms4aMFH",
    "tree_id": "E7fYCRWkNykc8HNZvEMRj5GuNYSwJ3WjA6HuLsh3YHvL"
  },
  "id": 1
}
```

### TypeScript

Pass the proof to a Bubblegum instruction as remaining accounts:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
import { PublicKey, AccountMeta } from '@solana/web3.js';

const RPC_URL = 'https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY';

async function getProofAccounts(assetId: string, canopyDepth = 0) {
  const response = await fetch(RPC_URL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 1,
      method: 'getAssetProof',
      params: { id: assetId },
    }),
  });
  const { result, error } = await response.json();
  if (error) throw new Error(error.message);

  // Nodes stored in the tree's canopy are already on chain and can be left out.
  const proofPath: AccountMeta[] = result.proof
    .slice(0, result.proof.length - canopyDepth)
    .map((node: string) => ({ pubkey: new PublicKey(node), isSigner: false, isWritable: false }));

  return { root: new PublicKey(result.root), proofPath };
}
```

## Notes

* A proof is valid only until the tree changes. Fetch it right before you build the transaction, and refetch if the transaction fails with a root mismatch.
* Trees with a canopy store the top levels on chain, so you can drop that many nodes from the end of `proof` to save transaction space.

## Common Errors

| Code | Message | Solution |
| - | - | - |
| -32602 | Pubkey Validation Err: ... is invalid | Pass a valid base-58 asset ID |
| -32000 | Asset Proof Not Found | The asset is not compressed, or it has not been indexed |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.