---
title: API Reference
description: Complete Go API reference for LiteSVM
---

Complete API documentation for `litesvm-go`. Method names mirror the Rust
`LiteSVM` builder where possible; getter / setter pairs use the same Go
convention (`Clock` / `SetClock`, `Rent` / `SetRent`, ...).

## API Sections

<Cards>
  <Card
    title="Account Management"
    description="Airdrop, Balance, GetAccount, SetAccount, NewAccount, programs"
    href="/docs/tools/litesvm/go/api-reference/account-management"
  />
  <Card
    title="Transactions"
    description="Send / simulate legacy + versioned transactions, TxOutcome"
    href="/docs/tools/litesvm/go/api-reference/transactions"
  />
  <Card
    title="Configuration"
    description="Toggles for sigverify, blockhash check, history, log limits, default programs"
    href="/docs/tools/litesvm/go/api-reference/configuration"
  />
  <Card
    title="Time & Sysvars"
    description="WarpToSlot, Clock, Rent, EpochSchedule, EpochRewards, SlotHashes, SlotHistory, StakeHistory"
    href="/docs/tools/litesvm/go/api-reference/time-and-sysvars"
  />
</Cards>

## Quick Reference

### Handle Setup

```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()
```

### Account Management

| Method                                                                       | Description                                          |
| ---------------------------------------------------------------------------- | ---------------------------------------------------- |
| `Airdrop(pubkey, lamports) error`                                            | Fund an account                                      |
| `Balance(pubkey) (uint64, bool, error)`                                      | SOL balance; bool reports whether the account exists |
| `GetAccount(pubkey) *Account`                                                | Retrieve an account handle (nil if missing)          |
| `SetAccount(pubkey, *Account) error`                                         | Store account state directly                         |
| `MinimumBalanceForRentExemption(dataLen int) (uint64, error)`                | Compute rent-exempt minimum                          |
| `NewAccount(lamports, data, owner, executable, rentEpoch) (*Account, error)` | Build an Account handle for SetAccount               |

### Program Management

| Method                                                   | Description                             |
| -------------------------------------------------------- | --------------------------------------- |
| `AddProgram(programID, bytes) error`                     | Load program from bytes                 |
| `AddProgramFromFile(programID, path) error`              | Load program from `.so` file            |
| `AddProgramWithLoader(programID, bytes, loaderID) error` | Load under a specific loader (advanced) |

### Transactions

| Method                                                                        | Description                                                                     |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `SendLegacyTransaction(txBytes) (*TxOutcome, error)`                          | Execute a legacy transaction                                                    |
| `SendVersionedTransaction(txBytes) (*TxOutcome, error)`                       | Execute a v0+ transaction                                                       |
| `SimulateLegacyTransaction(txBytes) (*TxOutcome, error)`                      | Simulate without state changes                                                  |
| `SimulateVersionedTransaction(txBytes) (*TxOutcome, error)`                   | Simulate v0+ without state changes                                              |
| `LatestBlockhash() (solana.Hash, error)`                                      | Current blockhash                                                               |
| `ExpireBlockhash() error`                                                     | Advance to a new blockhash                                                      |
| `GetTransaction(signature) *TxOutcome`                                        | Look up transaction in history (nil if absent)                                  |
| `litesvm.BuildTransferTx(payerSeed, to, lamports, blockhash) ([]byte, error)` | Test helper that builds a signed legacy transfer without pulling in `solana-go` |

### Configuration

| Method                                         | Description                                             |
| ---------------------------------------------- | ------------------------------------------------------- |
| `SetSigverify(bool) error`                     | Enable / disable signature verification                 |
| `Sigverify() (bool, error)`                    | Read the current setting                                |
| `SetBlockhashCheck(bool) error`                | Enable / disable blockhash validation                   |
| `SetTransactionHistory(int) error`             | Capacity of in-memory tx history (0 disables)           |
| `SetLogBytesLimit(int) error`                  | Per-tx log byte cap (negative = unlimited)              |
| `SetLamports(uint64) error`                    | Default lamports for new airdrop-pool accounts          |
| `SetSysvars() error`                           | Reset sysvars to defaults                               |
| `SetBuiltins() error`                          | Reload built-in programs                                |
| `SetDefaultPrograms() error`                   | Reload SPL Token, Memo, etc.                            |
| `SetPrecompiles() error`                       | Enable ed25519 / secp256k1 precompiles                  |
| `WithNativeMints() error`                      | Seed wrapped-SOL mint                                   |
| `SetFeatureSet(*FeatureSet) error`             | Install a feature gate set                              |
| `SetComputeBudget(ComputeBudget) error`        | Apply a compute budget                                  |
| `ComputeBudget() (ComputeBudget, bool, error)` | Read the current budget (bool reports "explicitly set") |

### Time and Sysvars

| Method                                       | Description                          |
| -------------------------------------------- | ------------------------------------ |
| `WarpToSlot(slot uint64) error`              | Jump to a specific slot              |
| `Clock() (Clock, error)`                     | Read the Clock sysvar                |
| `SetClock(Clock) error`                      | Overwrite the Clock sysvar           |
| `Rent() (Rent, error)`                       | Read the Rent sysvar                 |
| `SetRent(Rent) error`                        | Overwrite the Rent sysvar            |
| `EpochSchedule() (EpochSchedule, error)`     | Read the EpochSchedule sysvar        |
| `SetEpochSchedule(EpochSchedule) error`      | Overwrite the EpochSchedule sysvar   |
| `EpochRewards() (EpochRewards, error)`       | Read the EpochRewards sysvar         |
| `SetEpochRewards(EpochRewards) error`        | Overwrite the EpochRewards sysvar    |
| `LastRestartSlot() (uint64, error)`          | Read last-restart-slot               |
| `SetLastRestartSlot(uint64) error`           | Set last-restart-slot                |
| `SlotHashes() ([]SlotHash, error)`           | Read the SlotHashes sysvar           |
| `SetSlotHashes([]SlotHash) error`            | Overwrite the SlotHashes sysvar      |
| `SlotHistory() (*SlotHistory, error)`        | Read the SlotHistory sysvar (handle) |
| `SetSlotHistory(*SlotHistory) error`         | Overwrite the SlotHistory sysvar     |
| `StakeHistory() ([]StakeHistoryItem, error)` | Read the StakeHistory sysvar         |
| `SetStakeHistory([]StakeHistoryItem) error`  | Overwrite the StakeHistory sysvar    |

### Utilities

| Method                     | Description                                                    |
| -------------------------- | -------------------------------------------------------------- |
| `litesvm.Version() string` | Version string reported by the underlying Rust `litesvm` crate |
