RPC Guides Overview
Comprehensive guides for using X1 Blockchain RPC methods organized by use case
RPC Guides Overview
These guides organize X1 Blockchain RPC methods by use case, providing comprehensive examples and best practices for common blockchain operations.
Available Guides
Current State Queries
Real-time data methods for accounts, balances, and program data
Methods Covered:
- getAccountInfo
- getBalance
- getProgramAccounts
- getTokenAccountsByOwner
- getMultipleAccounts
Use Cases:
- Wallet balance displays
- Real-time dashboards
- Pre-transaction validation
- Token account queries
Historical Data Queries
Methods for accessing past transactions, blocks, and account history
Methods Covered:
- getTransaction
- getSignaturesForAddress
- getBlock
- getBlockTime
Use Cases:
- Transaction verification
- Analytics and reporting
- Audit trails
- Block explorers
Transaction Submission
Complete guide to sending and monitoring blockchain transactions
Methods Covered:
- sendTransaction
- simulateTransaction
- getFeeForMessage
Use Cases:
- SOL transfers
- Token operations
- Program execution
- Error handling
Network Information
Monitor cluster health, validators, and network status
Methods Covered:
- getHealth
- getEpochInfo
- getVoteAccounts
- getClusterNodes
- getVersion
Use Cases:
- Health monitoring
- Validator tracking
- Network analysis
- Status dashboards
Utility Methods
Helper methods for rent calculations, timing, and system operations
Methods Covered:
- getMinimumBalanceForRentExemption
- getLatestBlockhash
- getSlot
- getBlockHeight
Use Cases:
- Account creation costs
- Transaction building
- Timing coordination
- Cost estimation
Guide Features
Each guide includes:
- Method Overview - When and why to use each method
- Multi-language Examples - JavaScript, Python, and cURL examples
- Performance Tips - Credit costs and optimization strategies
- Best Practices - Common patterns and anti-patterns
- Real-world Use Cases - Complete working examples
- Error Handling - How to handle failures gracefully
Quick Start
New to X1 Blockchain RPC? Start with these guides:
- Start with Current State Queries - Learn to read blockchain data
- Move to Transaction Submission - Learn to write to the blockchain
- Explore Historical Data - Query past transactions
- Check Network Information - Monitor cluster health
- Use Utility Methods - Helper functions for common tasks
Example: Building a Complete Application
Here's how these guides work together in a real application:
// 1. Current State - Check balance before transaction
const balance = await connection.getBalance(wallet.publicKey);
// 2. Utility Methods - Get rent costs and blockhash
const rentCost = await connection.getMinimumBalanceForRentExemption(165);
const { blockhash } = await connection.getLatestBlockhash();
// 3. Transaction Submission - Build and send transaction
const transaction = new Transaction().add(/* instructions */);
transaction.recentBlockhash = blockhash;
const signature = await connection.sendTransaction(transaction, [wallet]);
// 4. Historical Data - Verify transaction
await connection.confirmTransaction(signature);
const txDetails = await connection.getTransaction(signature);
// 5. Network Info - Monitor health
const health = await connection.getHealth();
const epoch = await connection.getEpochInfo();Need Help?
- Complete Method Reference: RPC Methods Reference
- Rate Limits: Understanding Rate Limits
- Best Practices: Security Best Practices
- Examples: Code Examples
Credit Costs Summary
Understanding credit costs helps you optimize your application:
| Method Type | Credits | Examples |
|---|---|---|
| Simple Reads | 1 | getBalance, getHealth, getSlot |
| Account Queries | 1-3 | getAccountInfo (1), getMultipleAccounts (3) |
| Heavy Queries | 5 | getBlock, getTransaction, getProgramAccounts |
| Transactions | 10 | sendTransaction, simulateTransaction |
Pro Tip: Use the guides' performance tips sections to minimize credit usage while maximizing application performance.