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

> Truy xuất các bằng chứng bao hàm Merkle cho các cam kết trong cây trạng thái riêng tư.

## Bằng chứng bao hàm

Cung cấp từ 1 đến 1.000 cam kết từ cùng một cây trạng thái. Mỗi lá phải mã hóa một phần tử trường vô hướng BN254. Sử dụng cây và cam kết được trả về cùng với đầu ra đã mã hóa. Các bằng chứng tuân theo thứ tự của các lá được yêu cầu.

Mỗi bằng chứng bao gồm phần tử cùng cấp `path`, `leafIndex`, `root`, `rootSeq` và `rootIndex`. Đối với cây trạng thái, `rootSeq` là slot Solana đã hoàn tất, được dùng để xác định độ mới của bằng chứng. `rootIndex` là vị trí của root trong lịch sử root của tài khoản Solana; không thể tính giá trị này từ slot.

Nếu root đã lập chỉ mục hết hạn khỏi lịch sử root, hãy thử lại sau khi trình lập chỉ mục bắt kịp. [SDK](https://www.helius.dev/docs/vi/privacy/sdk.md) xử lý việc tập hợp bằng chứng cho các thao tác ví.

## Tham số yêu cầu

**leaves** `array` *required*

Các cam kết của cây trạng thái được mã hóa base58 dưới dạng phần tử trường vô hướng BN254 dài 32 byte.

**treeAccount** `string` *required*

Tài khoản cây trạng thái chứa các cam kết.


## OpenAPI

````yaml vi/openapi/privacy/getMerkleProofs.yaml POST /v1/spr/getMerkleProofs
openapi: 3.0.3
info:
  title: API Solana Privacy Rings
  version: 0.51.2
  description: >-
    API JSON-RPC của trình lập chỉ mục quyền riêng tư dành cho trạng thái được
    mã hóa, lịch sử, bằng chứng và bản ghi đăng ký công khai.
servers:
  - url: https://devnet.helius-rpc.com
    description: API Solana Privacy Rings trên Devnet
security: []
paths:
  /v1/spr/getMerkleProofs:
    post:
      summary: getMerkleProofs
      description: >-
        Truy xuất bằng chứng bao hàm Merkle cho các cam kết trong cây trạng thái
        riêng tư.
      operationId: getMerkleProofs
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                id:
                  type: string
                  description: ID dùng để nhận dạng yêu cầu.
                  default: '1'
                jsonrpc:
                  type: string
                  description: Phiên bản giao thức JSON-RPC.
                  enum:
                    - '2.0'
                  default: '2.0'
                method:
                  type: string
                  description: >-
                    Phương thức cần gọi. Phải khớp với phân đoạn cuối cùng của
                    đường dẫn 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: >-
                        Các cam kết cây trạng thái được mã hóa base58 dưới dạng
                        phần tử trường vô hướng BN254 dài 32 byte.
                    treeAccount:
                      allOf:
                        - $ref: '#/components/schemas/SerializablePubkey'
                      description: Tài khoản cây trạng thái chứa các cam kết.
                  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: Phản hồi JSON-RPC. Hãy kiểm tra lỗi trước khi đọc kết quả.
          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: ID của yêu cầu.
                  jsonrpc:
                    type: string
                    description: Phiên bản của giao thức 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: >-
            Bị từ chối trước khi thực thi. Phương thức và đường dẫn không khớp,
            trường phương thức bị trùng lặp hoặc yêu cầu hàng loạt sẽ trả về
            -32601. Phần nội dung không thể đọc hoặc quá lớn sẽ trả về -32600.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      ID yêu cầu hoặc null khi phần nội dung không phải là một
                      lệnh gọi JSON-RPC đơn lẻ.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '429':
          description: Đã vượt quá giới hạn tốc độ.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      ID yêu cầu hoặc null khi phần nội dung không phải là một
                      lệnh gọi JSON-RPC đơn lẻ.
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
                      data:
                        type: object
                        additionalProperties: true
        '500':
          description: Lỗi máy chủ nội bộ.
          content:
            application/json:
              schema:
                type: object
                required:
                  - jsonrpc
                  - id
                  - error
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                    nullable: true
                    description: >-
                      ID yêu cầu hoặc null khi phần nội dung không phải là một
                      lệnh gọi JSON-RPC đơn lẻ.
                  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: Hàm băm 32 byte được mã hóa base58.
    SerializablePubkey:
      type: string
      description: Khóa công khai Solana được mã hóa base58.
    Context:
      type: object
      required:
        - blockTime
        - slot
      properties:
        blockTime:
          type: integer
          format: int64
        slot:
          type: integer
          format: uint64
          description: >-
            Slot cao nhất mà trình lập chỉ mục đã lưu bền vững, dùng để kiểm tra
            độ mới dựa trên slot.
          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: >-
            Vị trí lịch sử thực tế trên chuỗi của `root`. Không thể suy ra vị
            trí của gốc trạng thái

            từ `root_seq`: các slot không có cập nhật sẽ không chiếm mục nào.
          minimum: 0
        rootSeq:
          type: integer
          format: uint64
          description: >-
            Khóa thứ tự gốc: slot Solana đã hoàn tất để xác định độ mới của bằng
            chứng cây trạng thái,

            hoặc trình tự cập nhật trên chuỗi đối với bằng chứng cây đã lập chỉ
            mục.
          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: Khóa API Helius của bạn.

````

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