Best Practices: How to land transactions on Solana
We’ve compiled the best practices when sending transactions on the Solana network to help you optimize performance, reduce latency, and improve the overall user experience of your application.
Ory · Founder @OrbitFlare
Sep 1, 2024 • 4 min read

<br/><br/> We've compiled the best practices when sending transactions on the Solana network to help you optimize performance, reduce latency, and improve the overall user experience of your application.
Manage Retries in Your Client or Backend
To ensure more predictable transaction delivery and enhance user experience, it's recommended to handle transaction retries within your client or backend system rather than relying on the RPC retry service.
- Set
maxRetries: 0when sending transactions.
By doing so, you prevent the RPC nodes from retrying transactions on your behalf, giving you full control over the retry logic and avoiding potential delays caused by saturated RPC queues.
Simulate Transactions Separately Before Sending
Simulating transactions can help you catch errors before sending, but it can also slow down transaction confirmations if not handled properly.
-
Use
simulateTransaction()in a separate RPC call before sending the actual transaction. -
Include
skipPreflight: truewhen sending the transaction to bypass preflight checks.
By simulating transactions separately, you enable more delivery routes that can speed up confirmations. Traders often skip simulations to save valuable milliseconds.
Use Reliable Blockhashes
Using the correct blockhash with the appropriate commitment level is crucial for transaction reliability.
-
Obtain blockhashes using a
finalizedcommitment level for maximum reliability. -
Using
confirmedcommitment works as well. -
Avoid using
processedcommitment for blockhashes.
Ensure that the commitment level of your connection for sendTransaction() matches the blockhash's commitment level to prevent inconsistencies.
Optimize Compute Unit (CU) Budgets
Setting an accurate Compute Unit (CU) budget helps validators efficiently pack your transaction into blocks, especially when space is limited.
-
Adjust the CU budget to match the actual requirements of your transaction.
-
The default CU budget is often higher than necessary.
For reference:
-
A simple SOL transfer requires approximately 500 CUs.
-
A token transfer requires approximately 5,000 CUs.
Include Priority Fees Wisely
Priority fees are essential for getting your transactions processed promptly, but overpaying doesn't necessarily yield better results.
-
Even a small priority fee (as little as 1 lamport) can be sufficient.
-
Check the prevailing rates for your writable accounts to set an appropriate fee.
Use the improved priority fees API to identify fees at different percentiles. Setting your priority fee slightly below the median value is generally effective. Avoid excessively high priority fees to conserve resources.
Avoid Relying on RPC Retries
During periods of network congestion, relying on RPC nodes to retry transactions can lead to delays and unpredictability.
Understanding Backpressure
"Backpressure" occurs when the network receives more transaction requests than it can handle, leading to queues on RPC nodes. This can saturate the queues, preventing RPCs from sending new transactions effectively.
The Solution
-
Implement retry logic within your application to handle transaction resubmissions.
-
Include
maxRetries: 0withsendTransaction()to disable RPC retry queues.
By taking control of the retry mechanism, you reduce dependency on RPC nodes and improve transaction delivery predictability.
Conclusion
By following these best practices, you can enhance the efficiency and reliability of transactions on the Solana network. Managing retries within your application, simulating transactions separately, using reliable blockhashes, optimizing CU budgets, and setting appropriate priority fees are key steps toward a more performant and user-friendly application.
Best Practices: How to land transactions on Solana
Related articles
Solana Archive Nodes and Historical Data: What Needs an Archive and How to Use It
Standard Solana nodes keep only days of history. Old blocks, transactions and signatures need an archive tier served through the same RPC methods. Which methods hit the archive, why there is no historical state query, and how to use history efficiently.
FundamentalsSolana Devnet vs Mainnet vs Testnet: Which Cluster for What
Mainnet beta is production, devnet is the developer playground with free SOL, testnet is for the network itself. What each cluster is for, how to point wallets and code at them, what differs in practice, and the mistakes from mixing them up.
FundamentalsSolana RPC Rate Limits: How They Work and How to Stop Hitting Them
Rate limits are a provider mechanism with three shapes: per second, per allowance and per method. How to diagnose which one you hit, and the changes (subscribe instead of poll, batch, cache, slice, fix retries) that cut request volume by an order of magnitude.