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

# getShieldedTransactionsByTags

> 检索与查看标签或特定环匹配的屏蔽交易事件。

## 交易历史记录

标签用于选择交易。`result.data` 中的每个条目都包含一笔选定 Solana 交易的所有事件；如果你提供 `ringProgramId`，则仅限该环中的事件。事件包括加密输出、消息、作废标识符和环元数据。在你的钱包中解密有效载荷，以恢复金额和资产。请参阅[私密历史记录指南](https://www.helius.dev/docs/zh/privacy/guides/read-history.md)。

标签可匹配输出查看标签和消息查看标签。空的 `tags` 数组要求提供 `ringProgramId`，并选择该环的历史记录，包括没有接收方标签的交易。当两者都提供时，交易必须同时匹配标签和环。

有关页面限制、续传代币和增量读取，请参阅[分页和数据新鲜度](https://www.helius.dev/docs/zh/api-reference/privacy.md#分页)。

## 请求参数

**filters** `object`

时隙范围。若要恢复已追上最新数据且无上限的读取，请将 `slot.gt` 设置为最后一页的 `context.slot`。

**filters.slot** `object`

读取的时隙范围。提供的范围条件通过 AND 组合。

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

仅包含此时隙之后的交易。

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

仅包含此时隙或之后的交易。

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

仅包含此时隙之前的交易。

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

仅包含此时隙或之前的交易。

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

每页最多包含的 Solana 交易数，取值范围为 1 到 1,000。

**minContextSlot** `number`

此次读取所需的索引器最低持久化时隙。如果索引器落后，则返回 JSON-RPC 错误 -32016。

**paginationToken** `string`

上一个响应中的续传代币。使用相同的标签、环和时隙筛选条件，将其原样传回。

**ringProgramId** `string`

将结果限制为由此程序 ID 授权的环。当 tags 为空时，此项为必填项。

**tags** `array` *required*

经过 Base58 编码的 32 字节查看标签，最多 1,000 个。空数组要求提供 ringProgramId，并选择该环。


## OpenAPI

````yaml zh/openapi/privacy/getShieldedTransactionsByTags.yaml POST /v1/spr/getShieldedTransactionsByTags
openapi: 3.0.3
info:
  title: Solana 隐私环 API
  version: 0.51.2
  description: 用于加密状态、历史记录、证明和公共注册记录的隐私索引器 JSON-RPC API。
servers:
  - url: https://devnet.helius-rpc.com
    description: Devnet Solana 隐私环 API
security: []
paths:
  /v1/spr/getShieldedTransactionsByTags:
    post:
      summary: getShieldedTransactionsByTags
      description: 检索与查看标签或特定环匹配的隐私交易事件。
      operationId: getShieldedTransactionsByTags
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                id:
                  type: string
                  description: 用于标识请求的 ID。
                  default: '1'
                jsonrpc:
                  type: string
                  description: JSON-RPC 协议版本。
                  enum:
                    - '2.0'
                  default: '2.0'
                method:
                  type: string
                  description: 要调用的方法。必须与 URL 的最后一个路径段匹配。
                  enum:
                    - getShieldedTransactionsByTags
                  default: getShieldedTransactionsByTags
                params:
                  type: object
                  required:
                    - tags
                  properties:
                    filters:
                      allOf:
                        - $ref: '#/components/schemas/HistoryFilters'
                      description: >-
                        槽位边界。若要恢复已追上进度且无上限的读取，请将 `slot.gt` 设置为上一页的
                        `context.slot`。
                    limit:
                      type: integer
                      format: uint64
                      maximum: 1000
                      minimum: 1
                      nullable: true
                      default: 1000
                      description: 每页最多包含的 Solana 交易数，范围为 1 到 1,000。
                    minContextSlot:
                      type: integer
                      format: uint64
                      minimum: 0
                      nullable: true
                      description: 此次读取要求索引器至少已持久化到该槽位。如果索引器落后，则返回 JSON-RPC 错误 -32016。
                    paginationToken:
                      type: string
                      description: 上一响应中的续传令牌。使用相同的标签、环和槽位筛选条件，将其原样传回。
                      nullable: true
                    ringProgramId:
                      type: string
                      description: 将结果限制为由此程序 ID 授权的环。当 tags 为空时必填。
                      nullable: true
                    tags:
                      type: array
                      items:
                        $ref: '#/components/schemas/Hash'
                      description: >-
                        采用 Base58 编码的 32 字节查看标签。最多 1,000 个。空数组要求提供
                        ringProgramId，并选择该环。
                      maxItems: 1000
                  additionalProperties: false
                  example:
                    tags:
                      - '11111111111111111111111111111112'
                    limit: 100
            example:
              jsonrpc: '2.0'
              id: '1'
              method: getShieldedTransactionsByTags
              params:
                tags:
                  - '11111111111111111111111111111112'
                limit: 100
        required: true
      responses:
        '200':
          description: JSON-RPC 响应。读取 result 前请先检查 error。
          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。
                  jsonrpc:
                    type: string
                    description: JSON-RPC 协议的版本。
                    enum:
                      - '2.0'
                  result:
                    type: object
                    description: 采用 gTFA 风格分页的单个有界历史读取页面。
                    required:
                      - context
                      - data
                      - paginationToken
                    properties:
                      context:
                        $ref: '#/components/schemas/Context'
                      data:
                        type: array
                        items:
                          type: object
                          description: 一个 Solana 交易返回的事件，按事件顺序排列。
                          required:
                            - slot
                            - signature
                            - events
                          properties:
                            events:
                              type: array
                              items:
                                $ref: '#/components/schemas/ShieldedTransaction'
                            signature:
                              $ref: '#/components/schemas/SerializableSignature'
                            slot:
                              type: integer
                              format: uint64
                              minimum: 0
                          additionalProperties: false
                      outputTreeId:
                        type: integer
                        format: uint16
                        description: 最新的未暂停状态树 ID。不可用时省略。
                        minimum: 0
                      paginationToken:
                        type: string
                        description: >-
                          下一页的令牌；没有更多匹配结果时为 null。对于不含 `lt` 或 `lte` 边界且已追上进度的

                          读取，稍后恢复时将 `filters.slot.gt` 设置为本页的
                          `context.slot`；有上限的读取仅涵盖不超过

                          其上限的槽位。
                        nullable: true
              example:
                jsonrpc: '2.0'
                id: '1'
                result:
                  context:
                    slot: 4242
                    blockTime: 1730000000
                  data: []
                  paginationToken: null
        '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: 请求 ID；当请求体不是单个 JSON-RPC 调用时为 null。
                  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: 请求 ID；当请求体不是单个 JSON-RPC 调用时为 null。
                  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: 请求 ID；当请求体不是单个 JSON-RPC 调用时为 null。
                  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: 历史查询的可选槽位边界。
      properties:
        slot:
          $ref: '#/components/schemas/SlotFilter'
      additionalProperties: false
    Hash:
      type: string
      description: 采用 Base58 编码的 32 字节哈希。
    Context:
      type: object
      required:
        - blockTime
        - slot
      properties:
        blockTime:
          type: integer
          format: int64
        slot:
          type: integer
          format: uint64
          description: 索引器已持久化的最高槽位，用于基于槽位的新鲜度检查。
          minimum: 0
    ShieldedTransaction:
      type: object
      required:
        - slot
        - txSignature
        - txViewingPk
        - salt
        - outputSlots
        - messages
        - nullifiers
        - proofless
      properties:
        eventIndex:
          type: integer
          format: uint16
          minimum: 0
        messages:
          type: array
          items:
            $ref: '#/components/schemas/RingsMessage'
          description: 未绑定到任何输出承诺的已发布数据槽位，将按原样重新发布。
        nullifiers:
          type: array
          items:
            $ref: '#/components/schemas/Hash'
        outputSlots:
          type: array
          items:
            $ref: '#/components/schemas/RingsOutputSlot'
        proofless:
          type: boolean
          description: 当此交易中至少有一个输出无证明时为 true。
        ringConfig:
          type: string
          description: 环的配置账户（其 `ring_auth` PDA）。当没有环授权此交易时省略。
        ringProgramId:
          type: string
          description: >-
            通过已建立索引的注册记录解析出的环程序。当省略 `ringConfig` 或环的注册记录尚未建立索引时省略。使用
            `ringConfig` 区分“无环”和“环的程序尚未建立索引”。
        salt:
          type: string
          description: 每个输出密文共享的交易级 AES 盐值。
          nullable: true
        slot:
          type: integer
          format: uint64
          minimum: 0
        txSignature:
          $ref: '#/components/schemas/SerializableSignature'
        txViewingPk:
          type: string
          description: 采用 Base64 编码的字节字符串。
          nullable: true
    SerializableSignature:
      type: string
      description: 采用 Base58 编码的 64 字节 Solana 交易签名。
    SlotFilter:
      type: object
      description: 读取的槽位边界。提供的边界使用 AND 组合。
      properties:
        gt:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: 仅包含此槽位之后的交易。
        gte:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: 仅包含此槽位或此槽位之后的交易。
        lt:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: 仅包含此槽位之前的交易。
        lte:
          type: integer
          format: uint64
          minimum: 0
          nullable: true
          description: 仅包含此槽位或此槽位之前的交易。
      additionalProperties: false
    RingsMessage:
      type: object
      required:
        - viewTag
        - payload
      properties:
        payload:
          $ref: '#/components/schemas/Base64String'
        viewTag:
          $ref: '#/components/schemas/Hash'
    RingsOutputSlot:
      type: object
      required:
        - viewTag
        - outputContext
        - payload
      properties:
        outputContext:
          $ref: '#/components/schemas/RingsOutputContext'
        payload:
          $ref: '#/components/schemas/Base64String'
        viewTag:
          $ref: '#/components/schemas/Hash'
    Base64String:
      type: string
      description: 采用 Base64 编码的字节字符串。
    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: 状态树账户。优先使用 treeId；树账户由它派生。
          deprecated: true
        treeId:
          type: integer
          format: uint16
          description: 对输出承诺进行哈希运算时所用的原始树 ID。
          minimum: 0
    SerializablePubkey:
      type: string
      description: 采用 Base58 编码的 Solana 公钥。
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: 你的 Helius API 密钥。

````

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