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

# getEncryptedUtxosByTags

> Truy xuất các đầu ra UTXO được mã hóa khớp với thẻ xem hoặc một vòng cụ thể.

## Đầu ra được mã hóa

Sử dụng phương thức này để lấy các UTXO được mã hóa nhằm giải mã ở phía máy khách. Ví của bạn giải mã các đầu ra và cộng các số tiền chưa chi tiêu của từng tài sản để xác định số dư riêng tư.

Phương thức này tương tự [`getTokenAccountsByOwner`](https://solana.com/docs/rpc/http/gettokenaccountsbyowner) của Solana, vốn trả về các tài khoản SPL Token thuộc sở hữu của một địa chỉ. Số dư riêng tư được lưu trữ trong các UTXO, không phải tài khoản Solana, vì vậy cần một phương thức RPC chuyên dụng. Tìm hiểu thêm về [Trạng thái riêng tư và UTXO](https://www.helius.dev/docs/vi/privacy/concepts/utxo.md).

Phương thức trả về các đầu ra khớp trong `result.data`, được nhóm theo giao dịch Solana. Mỗi mục bao gồm `slot` và `signature` của giao dịch. Một đầu ra bao gồm bản mã, thẻ xem, cam kết, ID cây và chỉ mục lá.

Phản hồi bao gồm các đầu ra trước đây có thể đã được chi tiêu. Ví của bạn phải theo dõi các nullifier để xác định số dư có thể chi tiêu. Xem [hướng dẫn về số dư riêng tư](https://www.helius.dev/docs/vi/privacy/guides/read-balance.md).

Mảng `tags` trống yêu cầu `ringProgramId` và chọn các đầu ra từ vòng đó. Khi cung cấp cả hai, đầu ra phải khớp với cả thẻ và vòng.

Xem [phân trang và độ mới](https://www.helius.dev/docs/vi/api-reference/privacy.md#phân-trang) để biết giới hạn trang, token tiếp tục và cách đọc tăng dần.

## Tham số yêu cầu

**filters** `object`

Giới hạn slot. Tiếp tục một lượt đọc không giới hạn đã bắt kịp bằng cách đặt `slot.gt` thành `context.slot` của trang cuối cùng.

**filters.slot** `object`

Giới hạn slot cho lượt đọc. Các giới hạn được cung cấp sẽ kết hợp bằng toán tử AND.

**filters.slot.gt** `number`

Chỉ bao gồm các giao dịch sau slot này.

**filters.slot.gte** `number`

Chỉ bao gồm các giao dịch tại hoặc sau slot này.

**filters.slot.lt** `number`

Chỉ bao gồm các giao dịch trước slot này.

**filters.slot.lte** `number`

Chỉ bao gồm các giao dịch tại hoặc trước slot này.

**limit** `number` (default: 1000)

Số lượng giao dịch Solana tối đa trên mỗi trang, từ 1 đến 1.000.

**minContextSlot** `number`

Slot tối thiểu đã được lưu bền vững của trình lập chỉ mục cần thiết cho lượt đọc này. Trả về lỗi JSON-RPC -32016 nếu trình lập chỉ mục bị chậm.

**paginationToken** `string`

Token tiếp tục từ phản hồi trước. Truyền lại token mà không thay đổi cùng với các thẻ, vòng và bộ lọc slot giống nhau.

**ringProgramId** `string`

Giới hạn kết quả ở vòng được ID chương trình này cấp quyền. Bắt buộc khi tags trống.

**tags** `array` *required*

Các thẻ xem 32 byte được mã hóa Base58. Tối đa 1.000 thẻ. Mảng trống yêu cầu ringProgramId và chọn vòng đó.


## OpenAPI

````yaml vi/openapi/privacy/getEncryptedUtxosByTags.yaml POST /v1/spr/getEncryptedUtxosByTags
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 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/getEncryptedUtxosByTags:
    post:
      summary: getEncryptedUtxosByTags
      description: >-
        Truy xuất các đầu ra UTXO được mã hóa khớp với thẻ xem hoặc một ring cụ
        thể.
      operationId: getEncryptedUtxosByTags
      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ủa đường
                    dẫn URL.
                  enum:
                    - getEncryptedUtxosByTags
                  default: getEncryptedUtxosByTags
                params:
                  type: object
                  required:
                    - tags
                  properties:
                    filters:
                      allOf:
                        - $ref: '#/components/schemas/HistoryFilters'
                      description: >-
                        Các giới hạn slot. Để tiếp tục một lượt đọc không giới
                        hạn đã bắt kịp, hãy đặt `slot.gt` thành `context.slot`
                        của trang cuối cùng.
                    limit:
                      type: integer
                      format: uint64
                      maximum: 1000
                      minimum: 1
                      nullable: true
                      default: 1000
                      description: >-
                        Số lượng giao dịch Solana tối đa trên mỗi trang, từ 1
                        đến 1.000.
                    minContextSlot:
                      type: integer
                      format: uint64
                      minimum: 0
                      nullable: true
                      description: >-
                        Slot tối thiểu đã được trình lập chỉ mục lưu bền vững,
                        cần thiết cho lượt đọc này. Trả về lỗi JSON-RPC -32016
                        nếu trình lập chỉ mục bị chậm hơn.
                    paginationToken:
                      type: string
                      description: >-
                        Token tiếp tục từ phản hồi trước. Truyền lại token mà
                        không thay đổi, cùng với các bộ lọc tags, ring và slot
                        giống nhau.
                      nullable: true
                    ringProgramId:
                      type: string
                      description: >-
                        Giới hạn kết quả ở ring được ID chương trình này ủy
                        quyền. Bắt buộc khi tags trống.
                      nullable: true
                    tags:
                      type: array
                      items:
                        $ref: '#/components/schemas/Hash'
                      description: >-
                        Các thẻ xem 32 byte được mã hóa base58. Tối đa 1.000
                        thẻ. Mảng trống yêu cầu ringProgramId và chọn ring đó.
                      maxItems: 1000
                  additionalProperties: false
                  example:
                    tags:
                      - '11111111111111111111111111111112'
                    limit: 100
            example:
              jsonrpc: '2.0'
              id: '1'
              method: getEncryptedUtxosByTags
              params:
                tags:
                  - '11111111111111111111111111111112'
                limit: 100
        required: true
      responses:
        '200':
          description: Phản hồi JSON-RPC. Kiểm tra error trước khi đọc 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: 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
                    description: >-
                      Một trang có giới hạn của lượt đọc lịch sử, sử dụng phân
                      trang kiểu gTFA.
                    required:
                      - context
                      - data
                      - paginationToken
                    properties:
                      context:
                        $ref: '#/components/schemas/Context'
                      data:
                        type: array
                        items:
                          type: object
                          description: Tất cả đầu ra khớp của một giao dịch Solana.
                          required:
                            - slot
                            - signature
                            - outputs
                          properties:
                            outputs:
                              type: array
                              items:
                                $ref: '#/components/schemas/EncryptedUtxoMatch'
                            signature:
                              $ref: '#/components/schemas/SerializableSignature'
                            slot:
                              type: integer
                              format: uint64
                              minimum: 0
                          additionalProperties: false
                      outputTreeId:
                        type: integer
                        format: uint16
                        description: >-
                          ID cây trạng thái mới nhất chưa bị tạm dừng. Bị lược
                          bỏ khi không khả dụng.
                        minimum: 0
                      paginationToken:
                        type: string
                        description: >-
                          Token cho trang tiếp theo; null khi không còn kết quả
                          khớp. Một lượt đọc đã bắt kịp

                          mà không có giới hạn `lt` hoặc `lte` sẽ tiếp tục sau
                          đó với `filters.slot.gt`

                          được đặt thành `context.slot` của trang này; lượt đọc
                          có giới hạn trên chỉ bao gồm các slot đến

                          giới hạn đó.
                        nullable: true
              example:
                jsonrpc: '2.0'
                id: '1'
                result:
                  context:
                    slot: 4242
                    blockTime: 1730000000
                  data: []
                  paginationToken: null
        '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 theo lô 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:
    HistoryFilters:
      type: object
      description: Các giới hạn slot tùy chọn cho truy vấn lịch sử.
      properties:
        slot:
          $ref: '#/components/schemas/SlotFilter'
      additionalProperties: false
    Hash:
      type: string
      description: Hàm băm 32 byte đượ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
    EncryptedUtxoMatch:
      type: object
      required:
        - slot
        - txSignature
        - txViewingPk
        - salt
        - outputSlot
      properties:
        outputSlot:
          $ref: '#/components/schemas/RingsOutputSlot'
        salt:
          type: string
          description: Salt AES cấp giao dịch được dùng chung cho bản mã của mọi đầu ra.
          nullable: true
        slot:
          type: integer
          format: uint64
          minimum: 0
        txSignature:
          $ref: '#/components/schemas/SerializableSignature'
        txViewingPk:
          type: string
          description: Chuỗi byte được mã hóa base64.
          nullable: true
    SerializableSignature:
      type: string
      description: Chữ ký giao dịch Solana 64 byte được mã hóa base58.
    SlotFilter:
      type: object
      description: >-
        Các giới hạn slot cho lượt đọc. Các giới hạn được cung cấp sẽ kết hợp
        bằng AND.
      properties:
        gt:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: Chỉ bao gồm các giao dịch sau slot này.
        gte:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: Chỉ bao gồm các giao dịch tại hoặc sau slot này.
        lt:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: Chỉ bao gồm các giao dịch trước slot này.
        lte:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: Chỉ bao gồm các giao dịch tại hoặc trước slot này.
      additionalProperties: false
    RingsOutputSlot:
      type: object
      required:
        - viewTag
        - outputContext
        - payload
      properties:
        outputContext:
          $ref: '#/components/schemas/RingsOutputContext'
        payload:
          $ref: '#/components/schemas/Base64String'
        viewTag:
          $ref: '#/components/schemas/Hash'
    RingsOutputContext:
      type: object
      required:
        - hash
        - tree
        - treeId
        - leafIndex
      properties:
        hash:
          $ref: '#/components/schemas/Hash'
        leafIndex:
          type: integer
          format: uint64
          minimum: 0
        tree:
          allOf:
            - $ref: '#/components/schemas/SerializablePubkey'
          description: >-
            Tài khoản cây trạng thái. Ưu tiên treeId; tài khoản cây được suy ra
            từ giá trị này.
          deprecated: true
        treeId:
          type: integer
          format: uint16
          description: ID cây thô mà cam kết của đầu ra được băm theo đó.
          minimum: 0
    Base64String:
      type: string
      description: Chuỗi byte được mã hóa base64.
    SerializablePubkey:
      type: string
      description: Khóa công khai Solana được mã hóa base58.
  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.