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

# getBlock

> Trả về thông tin nhận dạng và giao dịch của một khối đã được xác nhận trong sổ cái.

## Tham số yêu cầu

<ParamField body="slot" type="number" required>
  Số slot dưới dạng số nguyên `u64`.
</ParamField>

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

  * `finalized`
</ParamField>

<ParamField body="encoding" type="string" default="json">
  Định dạng mã hóa cho mỗi giao dịch được trả về.

  * `json`
  * `jsonParsed`
  * `base58`
  * `base64`
</ParamField>

<ParamField body="transactionDetails" type="string" default="full">
  Mức độ chi tiết của giao dịch cần trả về. Nếu yêu cầu thông tin tài khoản, chi tiết giao dịch chỉ bao gồm chữ ký và danh sách tài khoản có chú thích trong mỗi giao dịch. Siêu dữ liệu giao dịch chỉ bao gồm:  fee, err, pre\_balances, post\_balances, pre\_token\_balances và post\_token\_balances.

  * `full`
  * `accounts`
  * `signatures`
  * `none`
</ParamField>

<ParamField body="maxSupportedTransactionVersion" type="number">
  Phiên bản giao dịch tối đa được trả về trong các phản hồi. Đặt thành 1 để nhận các giao dịch legacy, v0 và v1. Nếu khối được yêu cầu chứa một giao dịch có phiên bản cao hơn, hệ thống sẽ trả về lỗi. Nếu bỏ qua, chỉ các giao dịch legacy được trả về.
</ParamField>

<ParamField body="rewards" type="boolean" default="true">
  Có điền dữ liệu vào mảng phần thưởng hay không.
</ParamField>


## OpenAPI

````yaml vi/openapi/rpc-http/getBlock.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API truy xuất dữ liệu khối Solana nâng cao để truy cập thông tin khối
    blockchain toàn diện, bao gồm giao dịch, chữ ký và phần thưởng, với mức độ
    chi tiết có thể cấu hình.
  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: getBlock
      description: >
        Truy xuất thông tin chi tiết về khối Solana cho một số slot cụ thể. Truy
        cập toàn bộ 

        dữ liệu khối, bao gồm giao dịch, chữ ký, thay đổi tài khoản, phần thưởng
        và thông tin thời gian.

        Cấu hình mức độ chi tiết của giao dịch và định dạng mã hóa để tối ưu hóa
        cho các nhu cầu 

        cụ thể của ứng dụng.
      operationId: getBlock
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Phiên bản giao thức JSON-RPC.
                  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
                  enum:
                    - getBlock
                  description: Tên của phương thức RPC cần gọi.
                  default: getBlock
                params:
                  type: array
                  description: Các tham số cho yêu cầu.
                  default:
                    - 430
                  items:
                    oneOf:
                      - type: integer
                        description: Số slot dưới dạng số nguyên `u64`.
                        example: 430
                      - type: object
                        description: Các tùy chọn cấu hình bổ sung cho yêu cầu.
                        properties:
                          commitment:
                            type: string
                            description: Mức cam kết cho yêu cầu.
                            enum:
                              - finalized
                            default: finalized
                          encoding:
                            type: string
                            description: Định dạng mã hóa cho từng giao dịch được trả về.
                            enum:
                              - json
                              - jsonParsed
                              - base58
                              - base64
                            default: json
                          transactionDetails:
                            type: string
                            description: >-
                              Mức độ chi tiết của giao dịch cần trả về. Nếu yêu
                              cầu tài khoản, thông tin chi tiết giao dịch chỉ
                              bao gồm chữ ký và danh sách tài khoản có chú thích
                              trong mỗi giao dịch. Siêu dữ liệu giao dịch chỉ
                              bao gồm: fee, err, pre_balances, post_balances,
                              pre_token_balances và post_token_balances.
                            enum:
                              - full
                              - accounts
                              - signatures
                              - none
                            default: full
                          maxSupportedTransactionVersion:
                            type: integer
                            description: >-
                              Phiên bản giao dịch tối đa cần trả về trong phản
                              hồi. Đặt thành 1 để nhận các giao dịch legacy, v0
                              và v1. Nếu khối được yêu cầu chứa giao dịch có
                              phiên bản cao hơn, hệ thống sẽ trả về lỗi. Nếu bỏ
                              qua, chỉ các giao dịch legacy được trả về.
                            example: 1
                          rewards:
                            type: boolean
                            description: Có điền dữ liệu vào mảng phần thưởng hay không.
                            default: true
      responses:
        '200':
          description: Đã truy xuất thành công thông tin chi tiết của khối.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    type: string
                  result:
                    type: object
                    properties:
                      blockhash:
                        type: string
                        description: Blockhash của khối này (chuỗi được mã hóa base-58).
                        example: DUCT8VSgk2BXkMhQfxKVYfikEZCQf4dZ4ioPdGdaVxMN
                      previousBlockhash:
                        type: string
                        description: Blockhash của khối cha.
                        example: HA2fJgGqmQezCXJRVNZAWPbRMXCPjUyo7VjRF47JGdYs
                      parentSlot:
                        type: integer
                        description: Chỉ mục slot của khối cha.
                        example: 429
                      transactions:
                        type: array
                        description: Mảng thông tin chi tiết giao dịch.
                        items:
                          type: object
                          properties:
                            meta:
                              type: object
                              nullable: true
                              description: Siêu dữ liệu liên quan đến giao dịch.
                            transaction:
                              type: object
                              description: Thông tin chi tiết giao dịch.
                              properties:
                                message:
                                  type: object
                                  properties:
                                    accountKeys:
                                      type: array
                                      description: >-
                                        Mảng khóa công khai của các tài khoản
                                        được sử dụng trong giao dịch này.
                                      items:
                                        type: string
                                    header:
                                      type: object
                                      properties:
                                        numReadonlySignedAccounts:
                                          type: integer
                                          description: Số tài khoản chỉ đọc có chữ ký.
                                        numReadonlyUnsignedAccounts:
                                          type: integer
                                          description: Số tài khoản chỉ đọc không có chữ ký.
                                        numRequiredSignatures:
                                          type: integer
                                          description: Số chữ ký bắt buộc.
                                    instructions:
                                      type: array
                                      description: Mảng các lệnh của chương trình.
                                      items:
                                        type: object
                                        properties:
                                          accounts:
                                            type: array
                                            description: Mảng chỉ mục tài khoản.
                                            items:
                                              type: integer
                                          data:
                                            type: string
                                            description: >-
                                              Dữ liệu đầu vào của chương trình được mã
                                              hóa bằng base58.
                                          programIdIndex:
                                            type: integer
                                            description: >-
                                              Chỉ mục của ID chương trình trong mảng
                                              accountKeys.
                                          stackHeight:
                                            type: integer
                                            nullable: true
                                            description: Độ cao ngăn xếp.
                                    recentBlockhash:
                                      type: string
                                      description: >-
                                        Blockhash gần đây được sử dụng trong
                                        giao dịch này.
                                signatures:
                                  type: array
                                  description: >-
                                    Mảng chữ ký cho giao dịch này (được mã hóa
                                    base-58).
                                  items:
                                    type: string
                      blockTime:
                        type: integer
                        nullable: true
                        description: Thời gian tạo ước tính dưới dạng dấu thời gian Unix.
                        example: null
                      blockHeight:
                        type: integer
                        nullable: true
                        description: Số khối nằm bên dưới khối này.
                        example: null
                      rewards:
                        type: array
                        description: Phần thưởng cho khối.
                        items:
                          type: object
                          properties:
                            pubkey:
                              type: string
                              description: >-
                                Khóa công khai của tài khoản đã nhận phần
                                thưởng.
                            lamports:
                              type: integer
                              description: Số lamport phần thưởng được ghi có hoặc ghi nợ.
                            rewardType:
                              type: string
                              nullable: true
                              description: 'Loại phần thưởng (ví dụ: "fee", "rent").'
        '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: Cổng kết nối hết thời gian chờ - 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: Cổng kết nối hết thời gian chờ
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
  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).

````