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 Validator | Solana CLI | Set up and run a local Solana validator |
Connecting to a Solana Environment | web3.js | Connect to different Solana networks |
Getting Test SOL | web3.js | Obtain SOL tokens for testing |
Subscribing to Events | web3.js | Listen to Solana program events |
Using Mainnet Accounts and Programs | 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 | 客户端 | Description |
---|---|---|
How to Create a Keypair | web3.js | Generate new Solana keypairs |
How to Restore a Keypair | web3.js | Recover existing keypairs |
How to Verify a Keypair | web3.js | Validate keypair authenticity |
How to Validate a Public Key | web3.js | Check public key validity |
How to Generate Mnemonics for Keypairs | bip39 | Create seed phrases |
How to Restore a Keypair from a Mnemonic | web3.js, bip39 | Recover keypairs using seed phrases |
How to Generate a Vanity Address | Solana CLI | Create custom addresses |
How to Sign and Verify a Message | web3.js | Message signing and verification |
How to Connect a Wallet with React | React, web3.js | Integrate wallets in React apps |
Transaction Operations #
Explore various transaction-related operations on the Solana blockchain.
Guide | 客户端 | Description |
---|---|---|
How to Send SOL | web3.js | Transfer SOL between accounts |
How to Send Tokens | web3.js | Transfer SPL tokens |
How to Calculate Transaction Cost | web3.js | Estimate transaction fees |
How to Add a Memo to a Transaction | web3.js | Include memos in transactions |
How to Add Priority Fees to a Transaction | web3.js | Set transaction priorities |
How to Optimize Compute Requested | web3.js | Improve transaction efficiency |
Offline Transactions | web3.js | Handle offline operations |
Account Management #
Learn how to manage Solana accounts effectively.
Guide | 客户端 | Description |
---|---|---|
How to Create an Account | web3.js | Create new Solana accounts |
How to Calculate Account Creation Cost | web3.js | Estimate account costs |
How to Create a PDA's Account | web3.js, Rust | Work with PDAs |
How to Sign with a PDA's Account | Rust | PDA signing operations |
How to Close an Account | Rust | Remove accounts |
How to Get Account Balance | web3.js | Check account balances |
Program Development #
Develop Solana programs with these comprehensive guides.
Guide | 客户端 | Description |
---|---|---|
How to Transfer SOL in a Solana Program | Rust | Program-based SOL transfers |
How to Get Clock in a Program | Rust | Access program clock |
How to Change Account Size | Rust | Modify account sizes |
How to Do Cross Program Invocation | Rust | CPI operations |
How to Create a Program Derived Address | Rust | Generate PDAs |
How to Read Accounts in a Program | Rust | Account data access |
Reading Multiple Instructions | Rust | Handle multiple instructions |
How to Verify Accounts in a Solana Program | Rust | Account verification |
Token Operations #
Comprehensive guides for working with tokens on Solana.
Guide | 客户端 | Description |
---|---|---|
How to Create a Token | web3.js | Create new tokens |
How to Get a Token Mint | web3.js | Access token mints |
How to Create a Token Account | web3.js | Set up token accounts |
How to Get a Token Account | web3.js | Retrieve token accounts |
How to Get a Token Account's Balance | web3.js, rust | Check token balances |
How to Mint Tokens | web3.js | Create new tokens |
How to Transfer Tokens | web3.js | Move tokens between accounts |
How to Burn Tokens | web3.js | Remove tokens from circulation |
How to Close Token Accounts | web3.js | Clean up token accounts |
How to Set Authority on Token Accounts or Mints | web3.js | Manage token permissions |
How to Delegate Token Accounts | web3.js | Set up token delegation |
How to Revoke a Token Delegate | web3.js | Remove delegates |
How to Use Wrapped SOL | web3.js | Work with wrapped SOL |
How to Get All Token Accounts by Authority | web3.js | List token accounts |
How to Create an NFT | web3.js | Mint NFTs |
How to Fetch the NFT Metadata | Javascript | Fetch NFT metadata |
How to Get the Owner of an NFT | web3.js | Find NFT ownership |
How to Get All NFTs from a Wallet | web3.js | List wallet NFTs |