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

# 시작하기

> @solana/kit와 LiteSVM으로 빠른 인프로세스 Solana 테스트하기

`solana-test-validator`를 띄우는 Solana 테스트 스위트는 테스트 하나당 수 초가 걸립니다.
프로세스 시작, RPC 연결, 네트워크 왕복을 기다려야 하기 때문입니다.
LiteSVM은 같은 테스트를 밀리초 단위로 실행합니다. 외부 프로세스도, 네트워크도 필요 없이
모든 것이 테스트 러너 내부의 메모리에서 동작합니다.

<Info>
  **테스트 버전:** `@solana/kit@8.6.0`, `@solana/kit-plugin-litesvm@0.23.0`,
  `@solana/kit-plugin-signer@0.23.0`, `@solana-program/system@0.16.0`,
  `@solana-program/token@0.18.0`, `litesvm@1.6.1`. 이 플러그인 패키지는
  아직 새로운 편이라 변경이 빠릅니다. 버전 불일치 문제가 발생하면 정확히 이 버전을
  설치하세요. 예: `npm install @solana/kit@8.6.0 @solana/kit-plugin-litesvm@0.23.0`.
</Info>

`@solana/kit`의 Kit 클라이언트는 `.use()`로 플러그인을 설치하여 구성합니다. 서명자 플러그인
([`@solana/kit-plugin-signer`](https://www.npmjs.com/package/@solana/kit-plugin-signer)),
LiteSVM 플러그인
([`@solana/kit-plugin-litesvm`](https://www.npmjs.com/package/@solana/kit-plugin-litesvm)),
그리고 필요한 프로그램 플러그인을 설치합니다. 이렇게 만든 클라이언트는 `client.sendTransaction()`,
`client.rpc`, 그리고 계정 상태, 클록, 시스템 변수(sysvar)에 대한 직접 접근 기능을 제공하며,
이 모든 것이 프로세스를 벗어나지 않고 이루어집니다.

## 빠른 시작

<Steps titleSize="h3">

<Step title="의존성 설치">
```bash
npm install @solana/kit @solana/kit-plugin-litesvm @solana/kit-plugin-signer @solana-program/system
```

</Step>

<Step title="클라이언트 생성">
```typescript
import { createClient, generateKeyPairSigner, lamports } from "@solana/kit";
import { litesvm } from "@solana/kit-plugin-litesvm";
import { signer } from "@solana/kit-plugin-signer";

// Payer first, then the LiteSVM transport.
const mySigner = await generateKeyPairSigner();
const client = createClient().use(signer(mySigner)).use(litesvm());

// Fund the payer
client.svm.airdrop(client.payer.address, lamports(5_000_000_000n));

// Check the balance
const balance = client.svm.getBalance(client.payer.address);
console.log("Balance:", balance, "lamports");
```

<Info>
  `createClient()`는 비어 있는 껍데기를 반환하며, `.use(plugin)`을 호출할 때마다
  기능이 한 겹씩 추가됩니다. `litesvm()`은 설치될 때 `client.payer`를 읽으므로
  `signer()` 플러그인은 반드시 `litesvm()`보다 **먼저** 설치해야 합니다. `signer(mySigner)`는 동일한 keypair를
  `payer`와 `identity` 모두로 설치하는 축약 방식이며, 두 역할을 분리하고 싶다면
  같은 패키지의 `payer()` 또는 `identity()`를 사용하세요.
</Info>

<Info>
  간단한 실험을 위해 한 줄로 설정하고 싶으신가요? `signer()`를 생략하고
  `@solana/kit-plugin-signer`의 `generatedPayer`와 `airdropPayer`를 사용하세요.
  `const client = await createClient().use(generatedPayer()).use(litesvm()).use(airdropPayer(lamports(10_000_000_000n)));`
  `generatedPayer()`는 `litesvm()` 앞에, `airdropPayer()`는 `litesvm()`이 제공하는
  에어드롭 함수가 필요하므로 그 뒤에 배치합니다. `signer()`와는 함께 사용하지 마세요
  (payer가 두 번 정의됩니다).
</Info>

</Step>

</Steps>

## 클라이언트 이해하기

`.use(signer(...)).use(litesvm())`을 호출하고 나면 클라이언트는 다음을 제공합니다.

| 속성                    | 설명                                                                                                                                                                                              |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client.payer`              | `signer()` 플러그인으로 설치한 `TransactionSigner` (`client.identity`로도 설정됨)                                                                                                         |
| `client.identity`           | 계정, 토큰, 권한을 소유하는 지갑 서명자                                                                                                                                            |
| `client.svm`                | 계정 관리, 트랜잭션, 설정을 위한 [`LiteSVM`](https://www.npmjs.com/package/litesvm) 인스턴스에 대한 직접 접근                                                                               |
| `client.rpc`                | Kit 호환 RPC 인터페이스 (일부 지원: `getAccountInfo`, `getBalance`, `getEpochSchedule`, `getLatestBlockhash`, `getMinimumBalanceForRentExemption`, `getMultipleAccounts`, `getSlot`, `requestAirdrop`) |
| `client.sendTransaction(s)` | 인스트럭션을 트랜잭션으로 구성, 서명하고 전송                                                                                                                                                       |
| `client.airdrop`            | LiteSVM faucet에서 SOL 요청                                                                                                                                                                      |
| `client.getMinimumBalance`  | rent 면제에 필요한 최소 lamports 계산                                                                                                                                                              |

### client.svm 사용하기

LiteSVM에 직접 접근하여 다음 작업을 할 수 있습니다.

- 계정 관리 (`setAccount`, `getAccount`, `airdrop`)
- 트랜잭션 실행 (`sendTransaction`, `simulateTransaction`)
- 설정 (`withSigverify`, `withBlockhashCheck` 등)
- 시간 조작 (`warpToSlot`, `getClock`)

```typescript
import { address, generateKeyPairSigner, lamports } from "@solana/kit";

const myAddress = (await generateKeyPairSigner()).address;

// Fund an account
client.svm.airdrop(myAddress, lamports(1_000_000_000n));

// Set account state directly
client.svm.setAccount({
  address: myAddress,
  data: new Uint8Array([1, 2, 3]),
  executable: false,
  lamports: lamports(1_000_000n),
  programAddress: address("11111111111111111111111111111111"),
  space: 3n
});

// Get the latest blockhash
const blockhash = client.svm.latestBlockhash();
```

### client.rpc 사용하기

표준 작업을 위한 Kit 호환 RPC 인터페이스입니다.

```typescript
// Get account info (returns base64-encoded data)
const { value: account } = await client.rpc.getAccountInfo(myAddress).send();

// Get multiple accounts in one call
const { value: accounts } = await client.rpc
  .getMultipleAccounts([myAddress, client.payer.address])
  .send();

// Get latest blockhash
const { value: latestBlockhash } = await client.rpc.getLatestBlockhash().send();
```

<Warning>
  RPC 계층은 **base64 인코딩**만 지원합니다. 다른 인코딩을 요청하면
  오류가 발생합니다.
</Warning>

## 설정

`client.svm`의 빌더 메서드로 LiteSVM을 설정합니다.

```typescript
const client = createClient().use(signer(mySigner)).use(litesvm());

// Configure for testing
client.svm
  .withSigverify(false) // Skip signature verification
  .withBlockhashCheck(false) // Skip blockhash validation
  .withSysvars() // Reset Clock, Rent, and other sysvars to their defaults
  .withBuiltins() // Enable ed25519, secp256k1
  .withTransactionHistory(100n); // Store transaction history
```

## 트랜잭션 전송하기

트랜스포트 뒤에 프로그램 플러그인을 추가하세요. 프로그램 플러그인은 클라이언트에
인스트럭션 빌더를 붙여 주므로 원시 `TransactionMessage`를 직접 다룰 일이 없습니다.

```typescript
import { createClient, generateKeyPairSigner, lamports } from "@solana/kit";
import { litesvm } from "@solana/kit-plugin-litesvm";
import { signer } from "@solana/kit-plugin-signer";
import { systemProgram } from "@solana-program/system";

const mySigner = await generateKeyPairSigner();
const client = createClient()
  .use(signer(mySigner))
  .use(litesvm())
  .use(systemProgram());

client.svm.airdrop(client.payer.address, lamports(10_000_000_000n));

const recipient = await generateKeyPairSigner();

// Build and send in one call
await client.system.instructions
  .transferSol({
    source: client.payer,
    destination: recipient.address,
    amount: lamports(1_000_000_000n)
  })
  .sendTransaction();
```

## SVM → RPC 흐름

SVM으로 상태를 설정하고 RPC로 읽을 수 있습니다.

```typescript
import { address, lamports } from "@solana/kit";

// Set account directly via SVM
client.svm.setAccount({
  address: myAddress,
  data: new Uint8Array([0xde, 0xad, 0xbe, 0xef]),
  executable: false,
  lamports: lamports(1_000_000n),
  programAddress: address("11111111111111111111111111111111"),
  space: 4n
});

// Read via RPC (returns base64-encoded data)
const { value } = await client.rpc.getAccountInfo(myAddress).send();
console.log("Data:", value?.data); // ['3q2+7w==', 'base64']
```

## 다음 단계

여기까지가 계정 생성, 인스트럭션 전송, 상태 읽기를 포함한 핵심 클라이언트 사용법입니다.
SPL 토큰(민트, ATA, 전송)이 포함된 테스트를 작성한다면 [토큰 테스트 가이드](/developers/docs/tools/litesvm/typescript/tokens)에서
`tokenProgram()` 플러그인이 약 40줄의 설정을 3번의 호출로 줄여 주는 방법을 확인하세요.
전체 API 레퍼런스는 [API 문서](/developers/docs/tools/litesvm/typescript/api-reference)를 참고하세요.
