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

# getLatestBlockhash

> getLatestBlockhash trả về blockhash Solana mới nhất để tạo các giao dịch mới. Blockhash hết hạn sau khoảng 150 slot — hãy lấy một blockhash ngay trước khi ký.

## Tham số yêu cầu

<ParamField body="commitment" type="string">
  Mức cam kết cho yêu cầu.

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

<ParamField body="minContextSlot" type="number">
  Slot tối thiểu mà yêu cầu có thể được đánh giá tại đó.
</ParamField>


## OpenAPI

````yaml vi/openapi/rpc-http/getLatestBlockhash.yaml POST /
openapi: 3.1.0
info:
  title: API RPC Solana
  version: 1.0.0
  description: >-
    API thiết yếu để chuẩn bị giao dịch Solana, dùng để truy xuất blockhash hợp
    lệ mới nhất cần thiết cho việc tạo và ký các giao dịch blockchain.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: Điểm cuối RPC Mainnet
  - url: https://devnet.helius-rpc.com
    description: Điểm cuối RPC Devnet
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getLatestBlockhash
      description: >
        Truy xuất blockhash hợp lệ mới nhất từ blockchain Solana, cần thiết để
        tạo giao dịch.

        API nền tảng này cung cấp blockhash hiện tại và thời hạn hiệu lực của
        nó, đây là các thành phần bắt buộc

        khi xây dựng bất kỳ giao dịch Solana nào. Blockhash vừa đóng vai trò là
        tham chiếu trạng thái gần đây,

        vừa là cơ chế bảo vệ chống phát lại. Mọi giao dịch phải bao gồm một
        blockhash gần đây

        để được mạng lưới xem là hợp lệ. Đây là API thiết yếu đối với các nhà
        cung cấp ví, DApp và mọi dịch vụ

        gửi giao dịch lên blockchain Solana.
      operationId: getLatestBlockhash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
              properties:
                jsonrpc:
                  type: string
                  description: Phiên bản giao thức JSON-RPC.
                  enum:
                    - '2.0'
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: Mã định danh duy nhất cho yêu cầu.
                  example: '1'
                  default: '1'
                method:
                  type: string
                  description: Tên của phương thức RPC cần gọi.
                  enum:
                    - getLatestBlockhash
                  example: getLatestBlockhash
                  default: getLatestBlockhash
                params:
                  type: array
                  description: Đối tượng cấu hình tùy chọn cho yêu cầu.
                  items:
                    type: object
                    properties:
                      commitment:
                        type: string
                        description: Mức độ cam kết cho yêu cầu.
                        enum:
                          - confirmed
                          - finalized
                          - processed
                        example: processed
                      minContextSlot:
                        type: integer
                        description: Slot tối thiểu mà tại đó yêu cầu có thể được đánh giá.
                        example: 1000
      responses:
        '200':
          description: Đã truy xuất thành công thông tin blockhash mới nhất.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: Phiên bản giao thức JSON-RPC.
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: Mã định danh khớp với yêu cầu.
                    example: '1'
                  result:
                    type: object
                    description: RpcResponse chứa thông tin blockhash.
                    properties:
                      context:
                        type: object
                        description: Ngữ cảnh của phản hồi.
                        properties:
                          slot:
                            type: integer
                            description: Slot mà tại đó dữ liệu được truy xuất.
                            example: 2792
                      value:
                        type: object
                        description: Blockhash và thông tin chi tiết về hiệu lực của nó.
                        properties:
                          blockhash:
                            type: string
                            description: >-
                              Blockhash Solana mới nhất được mã hóa dưới dạng
                              chuỗi base-58, cần thiết để tạo giao dịch.
                            example: EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N
                          lastValidBlockHeight:
                            type: integer
                            description: >-
                              Chiều cao khối Solana cuối cùng mà tại đó
                              blockhash này vẫn được chấp nhận trong các giao
                              dịch.
                            example: 3090
        '400':
          description: >-
            Yêu cầu không hợp lệ - Tham số yêu cầu không hợp lệ hoặc yêu cầu sai
            định dạng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Tham số không hợp lệ
                id: '1'
        '401':
          description: Không được phép - Khóa API không hợp lệ hoặc bị thiếu.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Không được phép
                id: '1'
        '429':
          description: Quá nhiều yêu cầu - Đã vượt quá giới hạn tốc độ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Quá nhiều yêu cầu
                id: '1'
        '500':
          description: Lỗi máy chủ nội bộ - Đã xảy ra lỗi trên máy chủ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Lỗi nội bộ
                id: '1'
        '503':
          description: Dịch vụ không khả dụng - Dịch vụ tạm thời không khả dụng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Dịch vụ không khả dụng
                id: '1'
        '504':
          description: Hết thời gian chờ cổng kết nối - Yêu cầu đã hết thời gian chờ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Hết thời gian chờ cổng kết nối
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: Phiên bản giao thức JSON-RPC.
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: Mã lỗi.
              example: -32602
            message:
              type: string
              description: Thông báo lỗi.
            data:
              type: object
              description: Dữ liệu bổ sung về lỗi.
        id:
          type: string
          description: Mã định danh khớp với yêu cầu.
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Khóa API Helius của bạn. Bạn có thể nhận khóa miễn phí trong [bảng điều
        khiển](https://dashboard.helius.dev/api-keys).

````