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

# getBlocksWithLimit

> Trả về danh sách các khối đã xác nhận, bắt đầu từ slot đã cho.

## Tham số yêu cầu

<ParamField body="start_slot" type="number">
  Số slot Solana bắt đầu truy xuất danh sách khối tuần tự.
</ParamField>

<ParamField body="limit" type="number">
  Số lượng khối tuần tự tối đa cần trả về (tối đa 500.000 khối cho mỗi yêu cầu).
</ParamField>

<ParamField body="commitment" type="string">
  Mức độ hoàn tất dùng để truy vấn các khối — confirmed (xác nhận lạc quan) hoặc finalized (xác nhận đầy đủ).

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


## OpenAPI

````yaml vi/openapi/rpc-http/getBlocksWithLimit.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API lịch sử blockchain để truy xuất các slot khối Solana liên tiếp trong một
    phạm vi xác định, với giới hạn có thể tùy chỉnh nhằm tối ưu hóa khối lượng
    dữ liệu và hiệu suất truy vấn.
  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: getBlocksWithLimit
      description: >
        Truy xuất một chuỗi khối Solana liên tục bắt đầu từ một slot cụ thể với
        giới hạn có thể tùy chỉnh.

        API lịch sử blockchain này trả về một mảng gồm các số slot khối đã được
        xác nhận trong phạm vi yêu cầu,

        cho phép phân trang hiệu quả qua các khối lịch sử. Tham số giới hạn được
        kiểm soát giúp quản lý

        kích thước phản hồi và hiệu suất khi quét các phần lớn của blockchain.
        Thiết yếu cho trình khám phá

        blockchain, công cụ phân tích dữ liệu lịch sử, hệ thống kiểm tra quét
        lịch sử giao dịch, dịch vụ lập chỉ mục,

        nền tảng phân tích dữ liệu và các ứng dụng cần xử lý hiệu quả các khối
        liên tiếp mà không

        vượt quá giới hạn bộ nhớ hoặc mạng. Mỗi yêu cầu chỉ có thể truy xuất tối
        đa 500.000 khối.
      operationId: getBlocksWithLimit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              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:
                    - getBlocksWithLimit
                  example: getBlocksWithLimit
                  default: getBlocksWithLimit
                params:
                  type: array
                  description: Các tham số yêu cầu cho phương thức.
                  default:
                    - 5
                    - 3
                  items:
                    type: object
                    properties:
                      start_slot:
                        type: integer
                        description: >-
                          Số slot Solana bắt đầu để tiến hành truy xuất danh
                          sách khối liên tiếp.
                        example: 5
                      limit:
                        type: integer
                        description: >-
                          Số lượng khối liên tiếp tối đa cần trả về (tối đa
                          500.000 khối cho mỗi yêu cầu).
                        example: 3
                      commitment:
                        type: string
                        description: >-
                          Mức độ hoàn tất để truy vấn khối — confirmed (xác nhận
                          lạc quan) hoặc finalized (xác nhận đầy đủ).
                        enum:
                          - confirmed
                          - finalized
                        example: finalized
      responses:
        '200':
          description: Đã truy xuất thành công các khối được xác nhận.
          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: array
                    description: >-
                      Danh sách có thứ tự gồm các số slot khối Solana đã được
                      xác nhận theo trình tự tăng dần, bắt đầu từ slot được yêu
                      cầu.
                    items:
                      type: integer
                    example:
                      - 5
                      - 6
                      - 7
        '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: Invalid params
                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: Unauthorized
                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: Too many requests
                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: Internal error
                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: Service unavailable
                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: Gateway timeout
                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.
  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).

````