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

# getMerkleProofs

> Retrieve Merkle inclusion proofs for commitments in a privacy state tree.

## Inclusion Proofs

Supply between 1 and 1,000 commitments from the same state tree. Each leaf must encode a BN254 scalar field element. Use the tree and commitment returned with an encrypted output. Proofs follow the order of the requested leaves.

Each proof includes the sibling `path`, `leafIndex`, `root`, `rootSeq`, and `rootIndex`. For state trees, `rootSeq` is the completed Solana slot used for proof freshness. `rootIndex` is the root's position in the Solana account's root history; it cannot be calculated from the slot.

If the indexed root has expired from the root history, retry after the indexer catches up. The [SDK](https://www.helius.dev/docs/privacy/sdk.md) handles proof assembly for wallet operations.

## Request Parameters

**leaves** `array` *required*

State tree commitments encoded as base58 32-byte BN254 scalar field elements.

**treeAccount** `string` *required*

State tree account containing the commitments.


## OpenAPI

````yaml openapi/privacy/getMerkleProofs.yaml POST /v1/spr/getMerkleProofs
openapi: 3.0.3
info:
  title: Solana Privacy Rings API
  version: 0.51.2
  description: >-
    Privacy indexer JSON-RPC API for encrypted state, history, proofs, and
    public registry records.
servers:
  - url: https://devnet.helius-rpc.com
    description: Devnet Solana Privacy Rings API
security: []
paths:
  /v1/spr/getMerkleProofs:
    post:
      summary: getMerkleProofs
      description: >-
        Retrieve Merkle inclusion proofs for commitments in a privacy state
        tree.
      operationId: getMerkleProofs
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                id:
                  type: string
                  description: An ID to identify the request.
                  default: '1'
                jsonrpc:
                  type: string
                  description: The JSON-RPC protocol version.
                  enum:
                    - '2.0'
                  default: '2.0'
                method:
                  type: string
                  description: The method to invoke. Must match the final URL path segment.
                  enum:
                    - getMerkleProofs
                  default: getMerkleProofs
                params:
                  type: object
                  required:
                    - treeAccount
                    - leaves
                  properties:
                    leaves:
                      type: array
                      items:
                        $ref: '#/components/schemas/Hash'
                      minItems: 1
                      maxItems: 1000
                      description: >-
                        State tree commitments encoded as base58 32-byte BN254
                        scalar field elements.
                    treeAccount:
                      allOf:
                        - $ref: '#/components/schemas/SerializablePubkey'
                      description: State tree account containing the commitments.
                  additionalProperties: false
                  example:
                    treeAccount: 33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN
                    leaves:
                      - '11111111111111111111111111111112'
            example:
              jsonrpc: '2.0'
              id: '1'
              method: getMerkleProofs
              params:
                treeAccount: 33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN
                leaves:
                  - '11111111111111111111111111111112'
        required: true
      responses:
        '200':
          description: JSON-RPC response. Inspect error before reading result.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
                  id:
                    type: string
                    description: The request ID.
                  jsonrpc:
                    type: string
                    description: The version of the JSON-RPC protocol.
                    enum:
                      - '2.0'
                  result:
                    type: object
                    required:
                      - context
                      - proofs
                    properties:
                      context:
                        $ref: '#/components/schemas/Context'
                      proofs:
                        type: array
                        items:
                          $ref: '#/components/schemas/MerkleProof'
                    additionalProperties: false
        '400':
          description: >-
            Rejected before execution. A method/path mismatch, duplicate method
            fields, or a batch request returns -32601. An unreadable or
            oversized body returns -32600.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      The request id, or null when the body is not a single
                      JSON-RPC call.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      The request id, or null when the body is not a single
                      JSON-RPC call.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      The request id, or null when the body is not a single
                      JSON-RPC call.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
      security:
        - ApiKeyQuery: []
components:
  schemas:
    Hash:
      type: string
      description: A base58-encoded 32-byte hash.
    SerializablePubkey:
      type: string
      description: A base58-encoded Solana public key.
    Context:
      type: object
      required:
        - blockTime
        - slot
      properties:
        blockTime:
          type: integer
          format: int64
        slot:
          type: integer
          format: uint64
          description: >-
            Highest slot the indexer has persisted, for slot-based freshness
            checks.
          minimum: 0
    MerkleProof:
      type: object
      required:
        - leaf
        - merkleContext
        - path
        - leafIndex
        - root
        - rootSeq
        - rootIndex
      properties:
        leaf:
          $ref: '#/components/schemas/Hash'
        leafIndex:
          type: integer
          format: uint64
          minimum: 0
        merkleContext:
          $ref: '#/components/schemas/MerkleContext'
        path:
          type: array
          items:
            $ref: '#/components/schemas/Hash'
        root:
          $ref: '#/components/schemas/Hash'
        rootIndex:
          type: integer
          format: uint16
          description: >-
            Actual on-chain history position for `root`. A state root's position
            is

            not derivable from `root_seq`: slots without updates consume no
            entry.
          minimum: 0
        rootSeq:
          type: integer
          format: uint64
          description: >-
            Root ordering key: the completed Solana slot for state-tree proof

            freshness, or the on-chain update sequence for an indexed-tree
            proof.
          minimum: 0
      additionalProperties: false
    MerkleContext:
      type: object
      required:
        - treeType
        - tree
      properties:
        tree:
          $ref: '#/components/schemas/SerializablePubkey'
        treeType:
          type: integer
          format: uint16
          minimum: 0
      additionalProperties: false
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: Your Helius API key.

````

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