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

> The Solana Cookbook is a collection of code snippets, useful examples, and references for building on Solana.

The Solana Cookbook is a developer resource that provides examples and
references for building applications on Solana. Each example and reference will
focus on specific aspects of Solana development while providing additional
details and usage examples.

The Python examples use `solana` 0.41 and its async client (`AsyncClient`),
which needs Python 3.11 or later. Install the tested versions:

```bash Terminal
pip install solana==0.41.0 solders==0.29.0
```

The Rust examples use the 2.x Solana crates. Most need these dependencies in
`Cargo.toml` (tested with Rust 1.89 and 1.98):

```toml Cargo.toml
[dependencies]
anyhow = "1"
tokio = { version = "1", features = ["full"] }
solana-client = "2"
solana-commitment-config = "2"
solana-sdk = "2"
solana-system-interface = "1"
```

Token examples also need `spl-token-interface = "1"` or
`spl-token-2022-interface = "1"`. Add any other crate an example's `use` lines
name; for `bincode`, use version 1.

## Development Guides

Development guides help developers set up and interact with the Solana ecosystem
using various tools and clients.

| Guide                                                                                      | Client                       | Description                                |
| ------------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------ |
| [How to Start a Local Validator](/developers/docs/intro/installation/surfpool-cli-basics)  | Solana CLI                   | Set up and run a local Solana validator    |
| [Connecting to a Solana Environment](/developers/cookbook/development/connect-environment) | JavaScript, Rust, Python, Go | Connect to different Solana networks       |
| [Getting Test SOL](/developers/cookbook/development/test-sol)                              | JavaScript, Rust, Python, Go | Obtain SOL tokens for testing              |
| [Subscribing to Events](/developers/cookbook/development/subscribing-events)               | JavaScript, Rust, Python, Go | Listen to Solana program events            |
| [Using Mainnet Accounts and Programs](/developers/docs/tools/surfpool)                     | Solana CLI                   | Work with production accounts and programs |

## Wallet Management

Learn how to create, restore, and manage Solana wallets using various tools and
libraries.

| Guide                                                                                                      | Client                       | Description                                 |
| ---------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------------------------------------- |
| [How to Create a Keypair](/developers/cookbook/wallets/create-keypair)                                     | JavaScript, Rust, Python, Go | Generate new Solana keypairs                |
| [How to Restore a Keypair](/developers/cookbook/wallets/restore-keypair)                                   | JavaScript, Rust, Python, Go | Recover existing keypairs                   |
| [How to Verify a Keypair](/developers/cookbook/wallets/verify-keypair)                                     | JavaScript, Rust, Python, Go | Validate keypair authenticity               |
| [How to Validate a Public Key](/developers/cookbook/wallets/check-publickey)                               | JavaScript, Rust, Python, Go | Check public key validity                   |
| [How to Generate Mnemonics for Keypairs](/developers/cookbook/wallets/generate-mnemonic)                   | JavaScript, Rust, Python, Go | Create seed phrases                         |
| [How to Restore a Keypair from a Mnemonic](/developers/cookbook/wallets/restore-from-mnemonic)             | JavaScript, Rust, Python, Go | Recover keypairs using seed phrases         |
| [How to Generate a Vanity Address](/developers/cookbook/wallets/generate-vanity-address)                   | Solana CLI                   | Create custom addresses                     |
| [How to Sign and Verify a Message](/developers/cookbook/wallets/sign-message)                              | JavaScript, Rust, Python, Go | Message signing and verification            |
| [How to Sign with a Keychain Backend](/developers/cookbook/wallets/sign-with-keychain)                     | JavaScript                   | Sign through a key-management backend       |
| [How to Connect a Wallet with React](/developers/cookbook/wallets/connect-wallet-react)                    | React, JavaScript            | Integrate wallets in React apps             |
| [How to Authenticate Users with Solana Wallets Using Supabase](/developers/cookbook/wallets/supabase-auth) | Next.js, Supabase            | Sign users in with a wallet signature       |
| [How to Auto Approve Transactions](/developers/cookbook/wallets/auto-approve)                              | Wallets, session keys        | Avoid a wallet prompt for every transaction |

## Transaction Operations

Explore various transaction-related operations on the Solana blockchain.

| Guide                                                                                            | Client                       | Description                    |
| ------------------------------------------------------------------------------------------------ | ---------------------------- | ------------------------------ |
| [How to Send SOL](/developers/cookbook/transactions/send-sol)                                    | JavaScript, Rust, Python, Go | Transfer SOL between accounts  |
| [How to Send Tokens](/developers/docs/tokens/basics/transfer-tokens)                             | JavaScript, Rust, Python     | Transfer SPL tokens            |
| [How to Calculate Transaction Cost](/developers/cookbook/transactions/calculate-cost)            | JavaScript, Rust, Python, Go | Estimate transaction fees      |
| [How to Add a Memo to a Transaction](/developers/cookbook/transactions/add-memo)                 | JavaScript, Rust, Python, Go | Include memos in transactions  |
| [How to Add Priority Fees to a Transaction](/developers/cookbook/transactions/add-priority-fees) | JavaScript, Rust, Python, Go | Set transaction priorities     |
| [How to Optimize Compute Requested](/developers/cookbook/transactions/optimize-compute)          | JavaScript, Rust, Python, Go | Improve transaction efficiency |
| [Partial Signing](/developers/docs/core/transactions/partial-signing)                            | JavaScript                   | Coordinate independent signers |

## Account Management

Learn how to manage Solana accounts effectively.

| Guide                                                                                  | Client                       | Description                |
| -------------------------------------------------------------------------------------- | ---------------------------- | -------------------------- |
| [How to Create an Account](/developers/cookbook/accounts/create-account)               | JavaScript, Rust, Python, Go | Create new Solana accounts |
| [How to Calculate Account Creation Cost](/developers/cookbook/accounts/calculate-rent) | JavaScript, Rust, Python, Go | Estimate account costs     |
| [How to Create a PDA's Account](/developers/docs/core/pda)                             | JavaScript, Rust             | Work with PDAs             |
| [How to Sign with a PDA's Account](/developers/docs/core/cpi)                          | Rust                         | PDA signing operations     |
| [How to Close an Account](/developers/docs/core/accounts)                              | Rust                         | Remove accounts            |
| [How to Get Account Balance](/developers/cookbook/accounts/get-account-balance)        | JavaScript, Rust, Python, Go | Check account balances     |

## Token Program Instructions

Refer to the [Token Program](/developers/docs/tokens/basics) section for code examples.
