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

# isBlockhashValid

> 返回一个区块哈希是否仍然有效。

## 请求参数

<ParamField body="blockhash" type="string" required>
  要检查有效性状态的 blockhash，作为 base-58 编码的字符串。
</ParamField>

<ParamField body="commitment" type="string">
  请求的承诺级别。

  * `confirmed`
  * `finalized`
  * `processed`
</ParamField>

<ParamField body="minContextSlot" type="number">
  请求可以评估的最低 slot。
</ParamField>


## OpenAPI

````yaml zh/openapi/rpc-http/isBlockhashValid.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: 用于检查先前获取的 Solana 区块哈希是否仍在其可用生命周期窗口内以进行新交易提交的交易有效性验证 API。
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: 主网 RPC 端点
  - url: https://devnet.helius-rpc.com
    description: 开发网 RPC 端点
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: isBlockhashValid
      description: >-
        验证 Solana 区块哈希是否仍然有效以用于交易提交。这个重要的交易准备 API
        允许应用程序确定先前获取的区块哈希是否仍在其有效窗口内（通常约 2 分钟或约 150
        个区块）。使用过期区块哈希构建的交易将被网络拒绝，因此在提交前检查有效性有助于防止交易失败和超时错误。对于钱包应用程序、交易所、支付处理器以及任何提前准备交易或需要检查待处理交易是否仍可提交或需要使用新的区块哈希重建以避免过期拒绝的服务至关重要。
      operationId: isBlockhashValid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: JSON-RPC 协议版本。
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: 请求的唯一标识符。
                  example: '45'
                  default: '1'
                method:
                  type: string
                  enum:
                    - isBlockhashValid
                  description: 要调用的 RPC 方法名称。
                  example: isBlockhashValid
                  default: isBlockhashValid
                params:
                  type: array
                  description: 用于评估区块哈希有效性的参数。
                  default:
                    - J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW
                    - commitment: processed
                  items:
                    oneOf:
                      - type: string
                        description: 要检查其有效性状态的Blockhash，作为base-58编码的字符串。
                        example: J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW
                      - type: object
                        description: 请求的配置选项。
                        properties:
                          commitment:
                            type: string
                            description: 请求的承诺级别。
                            enum:
                              - confirmed
                              - finalized
                              - processed
                            example: processed
                          minContextSlot:
                            type: integer
                            description: 请求可以评估的最小槽位。
                            example: 1000
            examples:
              default:
                $ref: '#/components/examples/isBlockhashValidRequest'
      responses:
        '200':
          description: 成功评估Blockhash的有效性。
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                    description: JSON-RPC协议版本。
                    example: '2.0'
                  id:
                    type: string
                    description: 与请求匹配的标识符。
                    example: '45'
                  result:
                    type: object
                    description: Blockhash有效性结果。
                    properties:
                      context:
                        type: object
                        description: 响应的上下文。
                        properties:
                          slot:
                            type: integer
                            description: 获取数据的槽位。
                            example: 2483
                      value:
                        type: boolean
                        description: 布尔值，指示此 blockhash 是否仍在其有效窗口内并可用于新交易。
                        example: false
              examples:
                default:
                  $ref: '#/components/examples/isBlockhashValidResponse'
        '400':
          description: 错误请求 - 请求参数无效或请求格式错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: 未授权 - API 密钥无效或缺失。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: 请求过多 - 超过速率限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: 内部服务器错误 - 服务器发生错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: 服务不可用 - 服务暂时不可用。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: 服务不可用
                id: '1'
        '504':
          description: 网关超时 - 请求超时。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: 网关超时
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  examples:
    isBlockhashValidRequest:
      value:
        jsonrpc: '2.0'
        id: '45'
        method: isBlockhashValid
        params:
          - J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW
          - commitment: processed
    isBlockhashValidResponse:
      value:
        jsonrpc: '2.0'
        id: '45'
        result:
          context:
            slot: 2483
          value: false
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: JSON-RPC 协议版本。
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: 错误代码。
              example: -32602
            message:
              type: string
              description: 错误信息。
            data:
              type: object
              description: 关于错误的附加数据。
        id:
          type: string
          description: 与请求匹配的标识符。
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        您的 Helius API
        密钥。您可以在[仪表板](https://dashboard.helius.dev/api-keys)中免费获取一个。

````