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

# SOL 전송

> litesvm-go로 SOL 전송 트랜잭션을 빌드하고 전송하기

가장 기본적인 Solana 트랜잭션인 한 계정에서 다른 계정으로 SOL을 이동하는 예제입니다. 더 복잡한 프로그램 로직을 테스트하기 전에 `litesvm-go` 설정이 올바르게 작동하는지 확인하는 첫 번째 테스트로 적합합니다.

## 전체 예제

```go
package mytest

import (
    "testing"

    litesvm "github.com/LiteSVM/litesvm-go"
    solana "github.com/gagliardetto/solana-go"
    "github.com/gagliardetto/solana-go/programs/system"
)

func TestSolTransfer(t *testing.T) {
    svm, err := litesvm.New()
    if err != nil {
        t.Fatal(err)
    }
    defer svm.Close()

    // Generate payer + recipient.
    priv, err := solana.NewRandomPrivateKey()
    if err != nil {
        t.Fatal(err)
    }
    payer := priv.PublicKey()
    recipient := solana.NewWallet().PublicKey()

    // Airdrop SOL to the payer.
    if err := svm.Airdrop(payer, 10_000_000_000); err != nil {
        t.Fatal(err)
    }

    // Check initial balance.
    senderInitial, _, err := svm.Balance(payer)
    if err != nil {
        t.Fatal(err)
    }
    t.Logf("sender initial: %.3f SOL", float64(senderInitial)/1e9)

    // Build, sign, and encode the transfer.
    blockhash, err := svm.LatestBlockhash()
    if err != nil {
        t.Fatal(err)
    }
    ix := system.NewTransferInstruction(1_000_000_000, payer, recipient).Build()
    tx, err := solana.NewTransaction(
        []solana.Instruction{ix},
        blockhash,
        solana.TransactionPayer(payer),
    )
    if err != nil {
        t.Fatal(err)
    }
    if _, err := tx.Sign(func(k solana.PublicKey) *solana.PrivateKey {
        if k.Equals(payer) {
            return &priv
        }
        return nil
    }); err != nil {
        t.Fatal(err)
    }
    txBytes, err := tx.MarshalBinary()
    if err != nil {
        t.Fatal(err)
    }

    // Execute the transfer.
    out, err := svm.SendLegacyTransaction(txBytes)
    if err != nil {
        t.Fatal(err)
    }

    if !out.IsOk() {
        t.Fatalf("tx failed: %s\nlogs: %v", out.Error(), out.Logs())
    }

    // Check final balances.
    senderFinal, _, err := svm.Balance(payer)
    if err != nil {
        t.Fatal(err)
    }
    recipientFinal, _, err := svm.Balance(recipient)
    if err != nil {
        t.Fatal(err)
    }
    t.Logf("sender final:    %.6f SOL", float64(senderFinal)/1e9)
    t.Logf("recipient final: %.3f SOL", float64(recipientFinal)/1e9)
    t.Logf("compute units:   %d", out.ComputeUnits())
    t.Logf("fee:             %d lamports", out.Fee())
}
```

## 예상 출력

```
sender initial: 10.000 SOL
sender final:    8.999995 SOL
recipient final: 1.000 SOL
compute units:   150
fee:             5000 lamports
```

<Info>
  트랜잭션 수수료(서명당 5,000 lamport)로 인해 발신자의 최종 잔액은 9 SOL보다 약간 적습니다.
</Info>

여기서는 가장 단순한 트랜잭션 유형을 다루었습니다. 사용자 지정 프로그램을 테스트하려면 [프로그램 테스트](/developers/docs/tools/litesvm/go/examples/program-testing)를 참고하세요. 시간에 따라 달라지는 로직은 [시간 기반 테스트](/developers/docs/tools/litesvm/go/examples/time-based)를 참고하세요.
