Skip to content
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:
Terminal
The Rust examples use the 2.x Solana crates. Most need these dependencies in Cargo.toml (tested with Rust 1.89 and 1.98):
Cargo.toml
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.
GuideClientDescription
How to Start a Local ValidatorSolana CLISet up and run a local Solana validator
Connecting to a Solana EnvironmentJavaScript, Rust, Python, GoConnect to different Solana networks
Getting Test SOLJavaScript, Rust, Python, GoObtain SOL tokens for testing
Subscribing to EventsJavaScript, Rust, Python, GoListen to Solana program events
Using Mainnet Accounts and ProgramsSolana CLIWork with production accounts and programs

​Wallet Management

Learn how to create, restore, and manage Solana wallets using various tools and libraries.
GuideClientDescription
How to Create a KeypairJavaScript, Rust, Python, GoGenerate new Solana keypairs
How to Restore a KeypairJavaScript, Rust, Python, GoRecover existing keypairs
How to Verify a KeypairJavaScript, Rust, Python, GoValidate keypair authenticity
How to Validate a Public KeyJavaScript, Rust, Python, GoCheck public key validity
How to Generate Mnemonics for KeypairsJavaScript, Rust, Python, GoCreate seed phrases
How to Restore a Keypair from a MnemonicJavaScript, Rust, Python, GoRecover keypairs using seed phrases
How to Generate a Vanity AddressSolana CLICreate custom addresses
How to Sign and Verify a MessageJavaScript, Rust, Python, GoMessage signing and verification
How to Sign with a Keychain BackendJavaScriptSign through a key-management backend
How to Connect a Wallet with ReactReact, JavaScriptIntegrate wallets in React apps
How to Authenticate Users with Solana Wallets Using SupabaseNext.js, SupabaseSign users in with a wallet signature
How to Auto Approve TransactionsWallets, session keysAvoid a wallet prompt for every transaction

​Transaction Operations

Explore various transaction-related operations on the Solana blockchain.
GuideClientDescription
How to Send SOLJavaScript, Rust, Python, GoTransfer SOL between accounts
How to Send TokensJavaScript, Rust, PythonTransfer SPL tokens
How to Calculate Transaction CostJavaScript, Rust, Python, GoEstimate transaction fees
How to Add a Memo to a TransactionJavaScript, Rust, Python, GoInclude memos in transactions
How to Add Priority Fees to a TransactionJavaScript, Rust, Python, GoSet transaction priorities
How to Optimize Compute RequestedJavaScript, Rust, Python, GoImprove transaction efficiency
Partial SigningJavaScriptCoordinate independent signers

​Account Management

Learn how to manage Solana accounts effectively.
GuideClientDescription
How to Create an AccountJavaScript, Rust, Python, GoCreate new Solana accounts
How to Calculate Account Creation CostJavaScript, Rust, Python, GoEstimate account costs
How to Create a PDA’s AccountJavaScript, RustWork with PDAs
How to Sign with a PDA’s AccountRustPDA signing operations
How to Close an AccountRustRemove accounts
How to Get Account BalanceJavaScript, Rust, Python, GoCheck account balances

​Token Program Instructions

Refer to the Token Program section for code examples.