Landing Transactions on Solana
Introduction
Understanding how transactions work on Solana is crucial for developers. This guide will help you grasp the basics and improve your transaction success rate.
What's a Blockhash?
A blockhash is like a timestamp for your transaction. It comes from the latest Proof of History (PoH) hash. Blockhashes prevent duplicate transactions and give them a lifespan. If a blockhash is too old (more than 150 blocks or about 1 minute 19 seconds), the transaction is rejected.
How Transactions are Submitted
Transactions can be sent to Solana in two ways:
- Through an RPC server
- Using a TPU (Transaction Processing Unit) Client
RPC Server Method
When you use an RPC server:
- It sends your transaction to the current and next leader validator
- It keeps trying every two seconds until the transaction is finalized or expires
TPU Client Method
The TPU Client just submits the transaction once. Your software needs to handle resending and forwarding to leaders.
How Transactions are Processed
Validators process transactions in five stages:
- Fetch: Receives and categorizes transactions
- SigVerify: Checks transaction signatures
- Banking: Filters and processes transactions
- Proof of History: Records the passage of time
- Broadcast: Sends processed transactions to the network
Why Do Transactions Fail?
Transactions can fail for several reasons:
- Network drops the transaction
- Blockhash is too old or incorrect
- RPC nodes are out of sync
- Temporary network forks
Tips for Successful Transactions
Here are some key tips to improve your transaction success rate:
- Use Recent Blockhashes: Get the latest blockhash with "confirmed" or "finalized" commitment
- Skip Preflight Checks: Set
skipPreflight
totrue
if you're confident in your transaction - Optimize Compute Units: Request only the compute units you need
- Use Priority Fees: Add dynamic priority fees to make your transaction more attractive to validators
- Implement Retry Logic: Create your own system to retry failed transactions
- Consider Staked Connections: These can improve your transaction priority
- Use Durable Nonces: For transactions that aren't time-sensitive
Conclusion
Landing transactions on Solana requires understanding the network and using the right strategies. By following these tips, you can significantly improve your success rate. As Solana evolves, stay informed about new updates and features to optimize your transactions.
RPC Nodes
Did you know? All RPC Nodes from us, use Staked Connections to send transactions!
By using our RPC Nodes, you automatically benefit from staked connections. This means:
- Higher priority for your transactions
- Improved transaction success rates
- Better overall performance for your Solana applications
To get started with our RPC Nodes, visit https://www.solanatracker.io/solana-rpc.