> ## 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

> Получение доказательств включения Меркла для обязательств в дереве состояний конфиденциальности.

## Доказательства включения

Передайте от 1 до 1 000 обязательств из одного дерева состояний. Каждый лист должен кодировать элемент скалярного поля BN254. Используйте дерево и обязательство, возвращенные вместе с зашифрованным выходом. Порядок доказательств соответствует порядку запрошенных листьев.

Каждое доказательство включает соседний элемент `path`, `leafIndex`, `root`, `rootSeq` и `rootIndex`. Для деревьев состояний `rootSeq` — это завершенный слот Solana, используемый для проверки актуальности доказательства. `rootIndex` — это позиция корня в истории корней аккаунта Solana; ее нельзя вычислить по слоту.

Если срок хранения индексированного корня в истории корней истек, повторите попытку после синхронизации индексатора. [SDK](https://www.helius.dev/docs/ru/privacy/sdk.md) выполняет сборку доказательств для операций кошелька.

## Параметры запроса

**leaves** `array` *required*

Обязательства дерева состояний, закодированные в формате base58 как 32-байтовые элементы скалярного поля BN254.

**treeAccount** `string` *required*

Аккаунт дерева состояний, содержащий обязательства.


## OpenAPI

````yaml ru/openapi/privacy/getMerkleProofs.yaml POST /v1/spr/getMerkleProofs
openapi: 3.0.3
info:
  title: API Solana Privacy Rings
  version: 0.51.2
  description: >-
    JSON-RPC API индексатора конфиденциальности для зашифрованного состояния,
    истории, доказательств и записей публичного реестра.
servers:
  - url: https://devnet.helius-rpc.com
    description: API Solana Privacy Rings для Devnet
security: []
paths:
  /v1/spr/getMerkleProofs:
    post:
      summary: getMerkleProofs
      description: >-
        Получает доказательства включения Меркла для обязательств в
        конфиденциальном дереве состояний.
      operationId: getMerkleProofs
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                id:
                  type: string
                  description: Идентификатор запроса.
                  default: '1'
                jsonrpc:
                  type: string
                  description: Версия протокола JSON-RPC.
                  enum:
                    - '2.0'
                  default: '2.0'
                method:
                  type: string
                  description: >-
                    Вызываемый метод. Должен соответствовать последнему сегменту
                    пути URL.
                  enum:
                    - getMerkleProofs
                  default: getMerkleProofs
                params:
                  type: object
                  required:
                    - treeAccount
                    - leaves
                  properties:
                    leaves:
                      type: array
                      items:
                        $ref: '#/components/schemas/Hash'
                      minItems: 1
                      maxItems: 1000
                      description: >-
                        Обязательства дерева состояний, закодированные в base58
                        как 32-байтовые элементы скалярного поля BN254.
                    treeAccount:
                      allOf:
                        - $ref: '#/components/schemas/SerializablePubkey'
                      description: >-
                        Учетная запись дерева состояний, содержащая
                        обязательства.
                  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. Проверьте поле error перед чтением поля 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: Идентификатор запроса.
                  jsonrpc:
                    type: string
                    description: Версия протокола JSON-RPC.
                    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: >-
            Запрос отклонен до выполнения. Несоответствие метода и пути,
            дублирующиеся поля метода или пакетный запрос возвращают -32601.
            Нечитаемое или слишком большое тело запроса возвращает -32600.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      Идентификатор запроса или null, если тело не является
                      одиночным вызовом JSON-RPC.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '429':
          description: Превышено ограничение частоты запросов.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      Идентификатор запроса или null, если тело не является
                      одиночным вызовом JSON-RPC.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '500':
          description: Внутренняя ошибка сервера.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      Идентификатор запроса или null, если тело не является
                      одиночным вызовом JSON-RPC.
                  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: 32-байтовый хеш в кодировке base58.
    SerializablePubkey:
      type: string
      description: Публичный ключ Solana в кодировке base58.
    Context:
      type: object
      required:
        - blockTime
        - slot
      properties:
        blockTime:
          type: integer
          format: int64
        slot:
          type: integer
          format: uint64
          description: >-
            Наибольший слот, сохраненный индексатором, для проверки актуальности
            по слотам.
          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: >-
            Фактическая позиция `root` в истории в блокчейне. Позицию корня
            состояния

            невозможно вывести из `root_seq`: слоты без обновлений не занимают
            записи.
          minimum: 0
        rootSeq:
          type: integer
          format: uint64
          description: >-
            Ключ упорядочивания корней: завершенный слот Solana для проверки
            актуальности доказательства дерева состояний

            или последовательность обновлений в блокчейне для доказательства
            индексированного дерева.
          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: Ваш ключ API Helius.

````

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