> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Tài liệu tham khảo API

> Tài liệu tham khảo API Go đầy đủ cho LiteSVM

Tài liệu API đầy đủ cho `litesvm-go` v0.3.0 trở lên. Tên phương thức phản chiếu builder `LiteSVM` của Rust khi có thể; các cặp getter / setter dùng cùng quy ước Go (`Clock` / `SetClock`, `Rent` / `SetRent`, ...). Tài khoản là các giá trị `*solana.Account` thuần và sysvar là các kiểu từ `github.com/gagliardetto/solana-go/sysvar`.

## Các phần của API

<Columns cols={2}>
  <Card title="Quản lý tài khoản" href="/developers/docs/tools/litesvm/go/api-reference/account-management">
    Airdrop, Balance, GetAccount, SetAccount, NewAccount, chương trình
  </Card>
  <Card title="Giao dịch" href="/developers/docs/tools/litesvm/go/api-reference/transactions">
    Gửi / mô phỏng giao dịch legacy + versioned, TxOutcome
  </Card>
  <Card title="Cấu hình" href="/developers/docs/tools/litesvm/go/api-reference/configuration">
    Các công tắc cho sigverify, kiểm tra blockhash, lịch sử, giới hạn log, chương trình mặc định
  </Card>
  <Card title="Thời gian & Sysvar" href="/developers/docs/tools/litesvm/go/api-reference/time-and-sysvars">
    WarpToSlot, Clock, Rent, EpochSchedule, EpochRewards, SlotHashes, SlotHistory, StakeHistory
  </Card>
</Columns>

## Tham khảo nhanh

### Thiết lập Handle

```go
import (
    litesvm "github.com/LiteSVM/litesvm-go"
    solana "github.com/gagliardetto/solana-go"
)

svm, err := litesvm.New()
if err != nil {
    // handle error
}
defer svm.Close()
```

### Quản lý tài khoản

| Phương thức                                                                       | Mô tả                                          |
| ---------------------------------------------------------------------------- | ---------------------------------------------------- |
| `Airdrop(pubkey, lamports) error`                                            | Nạp tiền cho một tài khoản                                      |
| `Balance(pubkey) (uint64, bool, error)`                                      | Số dư SOL; bool cho biết tài khoản có tồn tại hay không |
| `GetAccount(pubkey) *solana.Account`                                         | Bản sao của tài khoản (nil nếu không có)                 |
| `SetAccount(pubkey, *solana.Account) error`                                  | Lưu trực tiếp trạng thái tài khoản                         |
| `MinimumBalanceForRentExemption(dataLen int) (uint64, error)`                | Tính số dư tối thiểu để được miễn rent                          |
| `NewAccount(lamports, data, owner, executable, rentEpoch) (*solana.Account, error)` | Tạo một tài khoản để dùng cho SetAccount (có thể dùng literal `&solana.Account{...}`) |

### Quản lý chương trình

| Phương thức                                                   | Mô tả                             |
| -------------------------------------------------------- | --------------------------------------- |
| `AddProgram(programID, bytes) error`                     | Tải chương trình từ bytes                 |
| `AddProgramFromFile(programID, path) error`              | Tải chương trình từ tệp `.so`            |
| `AddProgramWithLoader(programID, bytes, loaderID) error` | Tải bằng một loader cụ thể (nâng cao) |

### Giao dịch

| Phương thức                                                                        | Mô tả                                                                     |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `SendLegacyTransaction(txBytes) (*TxOutcome, error)`                          | Thực thi một giao dịch legacy                                                    |
| `SendVersionedTransaction(txBytes) (*TxOutcome, error)`                       | Thực thi một giao dịch v0+                                                       |
| `SimulateLegacyTransaction(txBytes) (*TxOutcome, error)`                      | Mô phỏng mà không thay đổi trạng thái                                                  |
| `SimulateVersionedTransaction(txBytes) (*TxOutcome, error)`                   | Mô phỏng giao dịch v0+ mà không thay đổi trạng thái                                              |
| `LatestBlockhash() (solana.Hash, error)`                                      | Blockhash hiện tại                                                               |
| `ExpireBlockhash() error`                                                     | Chuyển sang blockhash mới                                                      |
| `GetTransaction(signature) *TxOutcome`                                        | Tra cứu giao dịch trong lịch sử (nil nếu không có)                                  |
| `litesvm.BuildTransferTx(payerSeed, to, lamports, blockhash) ([]byte, error)` | Hàm hỗ trợ kiểm thử để tạo giao dịch chuyển tiền legacy đã ký mà không cần kéo theo `solana-go` |

### Cấu hình

| Phương thức                                         | Mô tả                                             |
| ---------------------------------------------- | ------------------------------------------------------- |
| `SetSigverify(bool) error`                     | Bật / tắt xác minh chữ ký                 |
| `Sigverify() (bool, error)`                    | Đọc thiết lập hiện tại                                |
| `SetBlockhashCheck(bool) error`                | Bật / tắt xác thực blockhash                   |
| `SetTransactionHistory(int) error`             | Dung lượng lịch sử giao dịch trong bộ nhớ (0 là tắt)           |
| `SetLogBytesLimit(int) error`                  | Giới hạn byte log cho mỗi giao dịch (số âm = không giới hạn)              |
| `SetLamports(uint64) error`                    | Đặt lại số dư của pool airdrop                          |
| `SetSysvars() error`                           | Đặt lại các sysvar về mặc định                               |
| `SetBuiltins() error`                          | Tải lại các chương trình tích hợp sẵn                                |
| `SetDefaultPrograms() error`                   | Tải lại SPL Token, Memo, v.v.                            |
| `SetPrecompiles() error`                       | Bật các precompile ed25519 / secp256k1                  |
| `WithNativeMints() error`                      | Khởi tạo mint wrapped-SOL                                   |
| `SetFeatureSet(*FeatureSet) error`             | Cài đặt một tập feature gate                              |
| `SetComputeBudget(ComputeBudget) error`        | Áp dụng compute budget                                  |
| `ComputeBudget() (ComputeBudget, bool, error)` | Đọc budget hiện tại (bool cho biết "đã được đặt tường minh") |

### Thời gian và Sysvar

| Phương thức                                       | Mô tả                          |
| -------------------------------------------- | ------------------------------------ |
| `WarpToSlot(slot uint64) error`              | Nhảy tới một slot cụ thể              |
| `Clock() (*sysvar.Clock, error)`             | Đọc sysvar Clock                |
| `SetClock(*sysvar.Clock) error`              | Ghi đè sysvar Clock           |
| `Rent() (*sysvar.Rent, error)`               | Đọc sysvar Rent                 |
| `SetRent(*sysvar.Rent) error`                | Ghi đè sysvar Rent            |
| `EpochSchedule() (*sysvar.EpochSchedule, error)` | Đọc sysvar EpochSchedule    |
| `SetEpochSchedule(*sysvar.EpochSchedule) error` | Ghi đè sysvar EpochSchedule |
| `EpochRewards() (*sysvar.EpochRewards, error)` | Đọc sysvar EpochRewards       |
| `SetEpochRewards(*sysvar.EpochRewards) error` | Ghi đè sysvar EpochRewards   |
| `LastRestartSlot() (*sysvar.LastRestartSlot, error)` | Đọc last-restart-slot       |
| `SetLastRestartSlot(*sysvar.LastRestartSlot) error` | Đặt last-restart-slot         |
| `SlotHashes() (sysvar.SlotHashes, error)`    | Đọc sysvar SlotHashes           |
| `SetSlotHashes(sysvar.SlotHashes) error`     | Ghi đè sysvar SlotHashes      |
| `SlotHistory() (*sysvar.SlotHistory, error)` | Đọc sysvar SlotHistory          |
| `SetSlotHistory(*sysvar.SlotHistory) error`  | Ghi đè sysvar SlotHistory     |
| `StakeHistory() (sysvar.StakeHistory, error)` | Đọc sysvar StakeHistory        |
| `SetStakeHistory(sysvar.StakeHistory) error` | Ghi đè sysvar StakeHistory    |

### Tiện ích

| Phương thức                     | Mô tả                                                    |
| -------------------------- | -------------------------------------------------------------- |
| `litesvm.Version() string` | Mô tả engine (`litesvm-go (mithril svm, pure go)`) |
