Solana Cookbook

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.

Development Guides #

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

Guide客户端Description
How to Start a Local ValidatorSolana CLISet up and run a local Solana validator
Connecting to a Solana Environmentweb3.jsConnect to different Solana networks
Getting Test SOLweb3.jsObtain SOL tokens for testing
Subscribing to Eventsweb3.jsListen 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.

Guide客户端Description
How to Create a Keypairweb3.jsGenerate new Solana keypairs
How to Restore a Keypairweb3.jsRecover existing keypairs
How to Verify a Keypairweb3.jsValidate keypair authenticity
How to Validate a Public Keyweb3.jsCheck public key validity
How to Generate Mnemonics for Keypairsbip39Create seed phrases
How to Restore a Keypair from a Mnemonicweb3.js, bip39Recover keypairs using seed phrases
How to Generate a Vanity AddressSolana CLICreate custom addresses
How to Sign and Verify a Messageweb3.jsMessage signing and verification
How to Connect a Wallet with ReactReact, web3.jsIntegrate wallets in React apps

Transaction Operations #

Explore various transaction-related operations on the Solana blockchain.

Guide客户端Description
How to Send SOLweb3.jsTransfer SOL between accounts
How to Send Tokensweb3.jsTransfer SPL tokens
How to Calculate Transaction Costweb3.jsEstimate transaction fees
How to Add a Memo to a Transactionweb3.jsInclude memos in transactions
How to Add Priority Fees to a Transactionweb3.jsSet transaction priorities
How to Optimize Compute Requestedweb3.jsImprove transaction efficiency
Offline Transactionsweb3.jsHandle offline operations

Account Management #

Learn how to manage Solana accounts effectively.

Guide客户端Description
How to Create an Accountweb3.jsCreate new Solana accounts
How to Calculate Account Creation Costweb3.jsEstimate account costs
How to Create a PDA's Accountweb3.js, RustWork with PDAs
How to Sign with a PDA's AccountRustPDA signing operations
How to Close an AccountRustRemove accounts
How to Get Account Balanceweb3.jsCheck account balances

Program Development #

Develop Solana programs with these comprehensive guides.

Guide客户端Description
How to Transfer SOL in a Solana ProgramRustProgram-based SOL transfers
How to Get Clock in a ProgramRustAccess program clock
How to Change Account SizeRustModify account sizes
How to Do Cross Program InvocationRustCPI operations
How to Create a Program Derived AddressRustGenerate PDAs
How to Read Accounts in a ProgramRustAccount data access
Reading Multiple InstructionsRustHandle multiple instructions
How to Verify Accounts in a Solana ProgramRustAccount verification

Token Operations #

Comprehensive guides for working with tokens on Solana.

Guide客户端Description
How to Create a Tokenweb3.jsCreate new tokens
How to Get a Token Mintweb3.jsAccess token mints
How to Create a Token Accountweb3.jsSet up token accounts
How to Get a Token Accountweb3.jsRetrieve token accounts
How to Get a Token Account's Balanceweb3.js, rustCheck token balances
How to Mint Tokensweb3.jsCreate new tokens
How to Transfer Tokensweb3.jsMove tokens between accounts
How to Burn Tokensweb3.jsRemove tokens from circulation
How to Close Token Accountsweb3.jsClean up token accounts
How to Set Authority on Token Accounts or Mintsweb3.jsManage token permissions
How to Delegate Token Accountsweb3.jsSet up token delegation
How to Revoke a Token Delegateweb3.jsRemove delegates
How to Use Wrapped SOLweb3.jsWork with wrapped SOL
How to Get All Token Accounts by Authorityweb3.jsList token accounts
How to Create an NFTweb3.jsMint NFTs
How to Fetch the NFT MetadataJavascriptFetch NFT metadata
How to Get the Owner of an NFTweb3.jsFind NFT ownership
How to Get All NFTs from a Walletweb3.jsList wallet NFTs