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

# simulateBundle

> Mô phỏng một bundle JITO mà không thực thi trên blockchain.

## Tham số yêu cầu

<ParamField body="params[0]" type="object" required>
  Đối tượng cấu hình đầu tiên. Chứa các giao dịch đã mã hóa dùng cho quá trình mô phỏng.
</ParamField>

<ParamField body="params[0].encodedTransactions" type="array">
  Mảng gồm các giao dịch đã mã hóa và tuần tự hóa dùng cho quá trình mô phỏng. Kiểu mã hóa được xác định bởi trường `transactionEncoding` (mặc định là base-64).
</ParamField>

<ParamField body="params[1]" type="object">
  Đối tượng cấu hình thứ hai. Không bắt buộc.
</ParamField>

<ParamField body="params[1].preExecutionAccountsConfigs" type="array" required>
  Chỉ định các tài khoản cần ghi lại trong quá trình mô phỏng.

  Thao tác này ghi lại trạng thái tài khoản *trước khi* giao dịch được thực thi.

  Mỗi phần tử mảng tại một chỉ mục sẽ cấu hình giao dịch nằm ở cùng chỉ mục đó trong bundle.

  Đối với mỗi giao dịch trong bundle:

  * Truyền `null` nếu không muốn trả về bất kỳ trạng thái tài khoản nào.
  * Hoặc cung cấp một đối tượng mô tả các tài khoản cần trả về.

  Độ dài mảng phải bằng số lượng giao dịch trong bundle.
</ParamField>

<ParamField body="params[1].postExecutionAccountsConfigs" type="array" required>
  Chỉ định các tài khoản cần ghi lại trong quá trình mô phỏng.

  Thao tác này ghi lại trạng thái tài khoản *sau khi* giao dịch được thực thi.

  Mỗi phần tử mảng tại một chỉ mục sẽ cấu hình giao dịch nằm ở cùng chỉ mục đó trong bundle.

  Đối với mỗi giao dịch trong bundle:

  * Truyền `null` nếu không muốn trả về bất kỳ trạng thái tài khoản nào.
  * Hoặc cung cấp một đối tượng mô tả các tài khoản cần trả về.

  Độ dài mảng phải bằng số lượng giao dịch trong bundle.
</ParamField>

<ParamField body="params[1].transactionEncoding" type="string" default="base64">
  Kiểu mã hóa giao dịch được sử dụng trong `encodedTransactions`.

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

<ParamField body="params[1].simulationBank" type="any">
  Chỉ định bank dùng để chạy mô phỏng. Có thể là đầu chuỗi, một slot hoặc một mức cam kết.
</ParamField>

<ParamField body="params[1].skipSigVerify" type="boolean" default="false">
  Có bỏ qua bước xác minh chữ ký trước khi mô phỏng hay không.
</ParamField>

<ParamField body="params[1].replaceRecentBlockhash" type="boolean" default="false">
  Có thay thế blockhash gần đây của giao dịch được mô phỏng bằng blockhash mới nhất hay không.
</ParamField>


## OpenAPI

````yaml vi/openapi/rpc-http/simulateBundle.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API mô phỏng gói JITO để kiểm thử và xác thực việc thực thi gói trước khi
    gửi đến mạng Solana thông qua các trình xác thực JITO.
  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: simulateBundle
      description: >
        Mô phỏng một gói JITO mà không thực thi gói đó trên blockchain. Phương
        thức này cho phép nhà phát triển

        kiểm thử việc thực thi gói, xác minh hành vi giao dịch trong gói, ước
        tính mức tiêu thụ đơn vị tính toán,

        phát hiện lỗi và xem trước các thay đổi trạng thái tài khoản trước và
        sau khi thực thi gói.

        Chỉ dành riêng cho các trình xác thực JITO-Solana và rất cần thiết để
        phát triển chiến lược MEV

        cũng như tối ưu hóa gói.
      operationId: simulateBundle
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Phiên bản giao thức JSON-RPC.
                  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
                  enum:
                    - simulateBundle
                  description: Tên của phương thức RPC cần gọi.
                  example: simulateBundle
                  default: simulateBundle
                params:
                  type: array
                  description: Các tham số để mô phỏng một gói JITO.
                  default:
                    - encodedTransactions:
                        - >-
                          AUpZwml/cvAaQoRINPCXI/+Zp1bEG31TsbQ7YkESdUqtoGHrGSlZWLGh7qsa54Pon3RCx46Z6l+IlAgV8GNmbgcBAAED48eIT6fA5gQUuhts6qDwJ8rp6qemton7jK+tSNA6uiM3FVSCTsdmSMNKqTIUrKARpzIIQabdGWwDk74PLnrd/QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASgbUMGWXPNjQAwed9kPYG5gXZsBq9jrSuVNeTuC4o0IBAgIAAQwCAAAA6AMAAAAAAAA=
                    - preExecutionAccountsConfigs:
                        - null
                      postExecutionAccountsConfigs:
                        - null
                      skipSigVerify: true
                      transactionEncoding: base64
                      replaceRecentBlockhash: true
                  items:
                    type: object
                    description: Đối tượng cấu hình mô phỏng gói.
                    required:
                      - params[0]
                    properties:
                      params[0]:
                        type: object
                        description: >-
                          Đối tượng cấu hình đầu tiên. Chứa các giao dịch đã mã
                          hóa dùng cho quá trình mô phỏng.
                        properties:
                          encodedTransactions:
                            type: array
                            description: >-
                              Mảng các giao dịch đã mã hóa và tuần tự hóa dùng
                              cho quá trình mô phỏng. Kiểu mã hóa được xác định
                              bởi trường `transactionEncoding` (mặc định là
                              base-64).
                            items:
                              type: string
                              description: Giao dịch tuần tự hóa đã mã hóa.
                              example: >-
                                5rqF8aHfs9JyEtKTvND6z8RgBtYxQwZLndS1kzHxV7D3kWm9VoYRzFtsP3qra5bM8rGhCv82LYo8fZpQoyQmtN1D9vxG2uEsMhV7jB4KdADRgxMXn5kRJzLZPt2LrPSmcUhfEmeQa7XrKeR9FHdKcXxZ1Hdq68oBr2AaPpTMuL85KDCt
                      params[1]:
                        type: object
                        description: Đối tượng cấu hình thứ hai. Không bắt buộc.
                        required:
                          - preExecutionAccountsConfigs
                          - postExecutionAccountsConfigs
                        properties:
                          preExecutionAccountsConfigs:
                            type: array
                            description: >
                              Chỉ định các tài khoản cần ghi lại trong quá trình
                              mô phỏng.


                              Thuộc tính này ghi lại trạng thái tài khoản *trước
                              khi* giao dịch được thực thi.


                              Một phần tử mảng tại một chỉ mục sẽ cấu hình giao
                              dịch có cùng chỉ mục trong gói.


                              Đối với mỗi giao dịch trong gói:
                                - Truyền `null` nếu bạn không muốn trả về bất kỳ trạng thái tài khoản nào.
                                - Hoặc cung cấp một đối tượng mô tả các tài khoản cần trả về.

                              Độ dài mảng phải bằng số lượng giao dịch trong
                              gói.
                            items:
                              type:
                                - object
                                - 'null'
                              required:
                                - addresses
                              properties:
                                addresses:
                                  type: array
                                  description: >-
                                    Danh sách địa chỉ tài khoản được mã hóa
                                    base-58 cần ghi lại trạng thái.
                                  items:
                                    type: string
                                    description: Địa chỉ tài khoản được mã hóa base-58.
                                    example: >-
                                      TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                                encoding:
                                  type: string
                                  description: >
                                    Kiểu mã hóa dùng để trả về dữ liệu tài khoản
                                    đã ghi lại.
                                  default: base64
                                  enum:
                                    - binary
                                    - base58
                                    - base64
                                    - jsonParsed
                                    - base64+zstd
                                  example: base64
                          postExecutionAccountsConfigs:
                            type: array
                            description: >
                              Chỉ định các tài khoản cần ghi lại trong quá trình
                              mô phỏng.


                              Thuộc tính này ghi lại trạng thái tài khoản *sau
                              khi* giao dịch được thực thi.


                              Một phần tử mảng tại một chỉ mục sẽ cấu hình giao
                              dịch có cùng chỉ mục trong gói.


                              Đối với mỗi giao dịch trong gói:
                                - Truyền `null` nếu bạn không muốn trả về bất kỳ trạng thái tài khoản nào.
                                - Hoặc cung cấp một đối tượng mô tả các tài khoản cần trả về.

                              Độ dài mảng phải bằng số lượng giao dịch trong
                              gói.
                            items:
                              type:
                                - object
                                - 'null'
                              required:
                                - addresses
                              properties:
                                addresses:
                                  type: array
                                  description: >-
                                    Danh sách địa chỉ tài khoản được mã hóa
                                    base-58 cần ghi lại trạng thái.
                                  items:
                                    type: string
                                    description: Địa chỉ tài khoản được mã hóa base-58.
                                    example: >-
                                      TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                                encoding:
                                  type: string
                                  description: >
                                    Kiểu mã hóa dùng để trả về dữ liệu tài khoản
                                    đã ghi lại.
                                  default: base64
                                  enum:
                                    - binary
                                    - base58
                                    - base64
                                    - jsonParsed
                                    - base64+zstd
                                  example: base64
                          transactionEncoding:
                            type: string
                            description: >-
                              Kiểu mã hóa giao dịch được sử dụng trong
                              `encodedTransactions`.
                            enum:
                              - base64
                              - base58
                            default: base64
                          simulationBank:
                            description: >
                              Chỉ định bank để chạy mô phỏng. Có thể là tip, một
                              slot hoặc một mức độ cam kết.
                            oneOf:
                              - type: string
                                description: >-
                                  Sử dụng bank của slot cao nhất của RPC, tức là
                                  bank đang hoạt động.
                                example: tip
                              - type: object
                                description: >-
                                  Mô phỏng trên bank của slot được cung cấp (có
                                  thể không khả dụng).
                                properties:
                                  slot:
                                    type: integer
                                    example: 373976835
                                required:
                                  - slot
                              - type: object
                                description: Xác định mức độ cam kết để chạy mô phỏng.
                                properties:
                                  commitment:
                                    type: object
                                    properties:
                                      commitment:
                                        type: string
                                        enum:
                                          - processed
                                          - confirmed
                                          - finalized
                                        description: Mức độ cam kết để chạy mô phỏng.
                                        example: processed
                                    required:
                                      - commitment
                                required:
                                  - commitment
                          skipSigVerify:
                            type: boolean
                            description: >-
                              Có bỏ qua bước xác minh chữ ký trước khi mô phỏng
                              hay không.
                            default: false
                          replaceRecentBlockhash:
                            type: boolean
                            description: >-
                              Có thay thế blockhash gần đây của giao dịch được
                              mô phỏng bằng blockhash mới nhất hay không.
                            default: false
      responses:
        '200':
          description: Đã mô phỏng gói thành công.
          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: Kết quả của gói được mô phỏng.
                    properties:
                      context:
                        type: object
                        description: Ngữ cảnh của phản hồi mô phỏng.
                        properties:
                          apiVersion:
                            type: string
                            description: Phiên bản API.
                            example: 2.30.10
                          slot:
                            type: integer
                            description: Slot nơi dữ liệu được xử lý.
                            example: 373999891
                      value:
                        type: object
                        description: Chi tiết kết quả mô phỏng gói.
                        properties:
                          summary:
                            description: >
                              Tóm tắt kết quả mô phỏng gói.


                              Nếu mô phỏng thành công, giá trị này được đặt
                              thành `"succeeded"`.


                              Nếu mô phỏng thất bại, giá trị này được đặt thành
                              một đối tượng có một trường duy nhất là `failed`,
                              chứa thông tin chi tiết về lỗi đó.
                            oneOf:
                              - type: string
                                example: succeeded
                              - type: object
                                required:
                                  - failed
                                properties:
                                  failed:
                                    type: object
                                    required:
                                      - error
                                    properties:
                                      error:
                                        description: >-
                                          Giá trị chứa thông tin chi tiết về lỗi.
                                          Cấu trúc có thể khác nhau.
                                      tx_signature:
                                        type: string
                                        description: >-
                                          Chữ ký của giao dịch thất bại ở định
                                          dạng base58. Có thể là `null` nếu không
                                          áp dụng.
                          transactionResults:
                            type: array
                            description: >-
                              Mảng kết quả cho từng giao dịch trong gói. Có thể
                              rỗng nếu xảy ra lỗi.
                            items:
                              type: object
                              properties:
                                err:
                                  type:
                                    - object
                                    - 'null'
                                  description: >-
                                    Lỗi nếu giao dịch thất bại, `null` nếu thành
                                    công.
                                logs:
                                  type:
                                    - array
                                    - 'null'
                                  description: >-
                                    Mảng thông báo nhật ký từ quá trình thực thi
                                    giao dịch.
                                  items:
                                    type: string
                                    example: >-
                                      Program
                                      4Nd1mFvxhG1DQMLUKhMzrZ7yG1UrjC9xXH6kvvZtcg9R
                                      invoke [1]
                                preExecutionAccounts:
                                  type:
                                    - array
                                    - 'null'
                                  description: >-
                                    Trạng thái tài khoản trước khi thực thi giao
                                    dịch.
                                  items:
                                    type: object
                                    properties:
                                      data:
                                        type: string
                                        description: Dữ liệu liên kết với tài khoản.
                                      executable:
                                        type: boolean
                                        description: >-
                                          Tài khoản có chứa chương trình hay
                                          không.
                                        example: false
                                      lamports:
                                        type: integer
                                        description: Số lamport được gán cho tài khoản này.
                                        example: 1500000000
                                      owner:
                                        type: string
                                        description: >-
                                          Địa chỉ của chương trình sở hữu tài
                                          khoản này.
                                        example: >-
                                          4Nd1mFvxhG1DQMLUKhMzrZ7yG1UrjC9xXH6kvvZtcg9R
                                      rentEpoch:
                                        type: integer
                                        description: >-
                                          Epoch mà tại đó tài khoản này sẽ phải
                                          trả tiền thuê tiếp theo.
                                        example: 324
                                      space:
                                        type: integer
                                        description: Kích thước dữ liệu của tài khoản.
                                        example: 1024
                                postExecutionAccounts:
                                  type:
                                    - array
                                    - 'null'
                                  description: >-
                                    Trạng thái tài khoản sau khi thực thi giao
                                    dịch.
                                  items:
                                    type: object
                                    properties:
                                      data:
                                        type: string
                                        description: Dữ liệu liên kết với tài khoản.
                                      executable:
                                        type: boolean
                                        description: >-
                                          Tài khoản có chứa chương trình hay
                                          không.
                                        example: false
                                      lamports:
                                        type: integer
                                        description: Số lamport được gán cho tài khoản này.
                                        example: 1500000000
                                      owner:
                                        type: string
                                        description: >-
                                          Địa chỉ của chương trình sở hữu tài
                                          khoản này.
                                        example: >-
                                          4Nd1mFvxhG1DQMLUKhMzrZ7yG1UrjC9xXH6kvvZtcg9R
                                      rentEpoch:
                                        type: integer
                                        description: >-
                                          Epoch mà tại đó tài khoản này sẽ phải
                                          trả tiền thuê tiếp theo.
                                        example: 324
                                      space:
                                        type: integer
                                        description: Kích thước dữ liệu của tài khoản.
                                        example: 1024
                                unitsConsumed:
                                  type: integer
                                  description: >-
                                    Số đơn vị ngân sách tính toán đã tiêu thụ
                                    trong quá trình xử lý.
                                  example: 200000
                                returnData:
                                  type:
                                    - object
                                    - 'null'
                                  description: >-
                                    Dữ liệu trả về gần đây nhất do một chỉ thị
                                    tạo ra.
                                  properties:
                                    programId:
                                      type: string
                                      description: Chương trình đã tạo dữ liệu trả về.
                                      example: >-
                                        Fx9Hp1gLzYj6Ryc4GaVoq2v6t4NxWg3GT1kP7quzZbVQ
                                    data:
                                      type: string
                                      description: >-
                                        Dữ liệu trả về ở dạng dữ liệu nhị phân
                                        được mã hóa base-64.
                                      example: >-
                                        AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASjD8=
              example:
                jsonrpc: '2.0'
                id: '1'
                result:
                  context:
                    apiVersion: 2.30.10
                    slot: 373999891
                  value:
                    summary: succeeded
                    transactionResults:
                      - err: null
                        logs:
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            invoke [1]
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            success
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            invoke [1]
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            success
                          - Program 11111111111111111111111111111111 invoke [1]
                          - Program 11111111111111111111111111111111 success
                        preExecutionAccounts:
                          - data:
                              - ''
                              - base64
                            executable: true
                            lamports: 5299606121
                            owner: BPFLoader2111111111111111111111111111111111
                            rentEpoch: 324
                            space: 134080
                        postExecutionAccounts:
                          - data:
                              - ''
                              - base64
                            executable: true
                            lamports: 5299606121
                            owner: BPFLoader2111111111111111111111111111111111
                            rentEpoch: 324
                            space: 134080
                        returnData:
                          programId: Fx9Hp1gLzYj6Ryc4GaVoq2v6t4NxWg3GT1kP7quzZbVQ
                          data: AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASjD8=
                        unitsConsumed: 450
                      - err: null
                        logs:
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            invoke [1]
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            success
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            invoke [1]
                          - >-
                            Program ComputeBudget111111111111111111111111111111
                            success
                          - Program 11111111111111111111111111111111 invoke [1]
                          - Program 11111111111111111111111111111111 success
                        postExecutionAccounts: null
                        preExecutionAccounts: null
                        returnData: null
                        unitsConsumed: 450
        '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.
        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).

````