The Manual Workflow
Manually sending a transaction involves the following steps:Build the Initial Transaction
Assemble your instructions and sign the transaction so it can be simulated.
Optimize Compute Units
Simulate the transaction to determine the precise CUs needed and add a small buffer.
Add Priority Fees
Get a fee estimate from the Helius Priority Fee API and add it to your transaction.
The Helius SDKs are open-source. You can view the underlying code for the
sendSmartTransaction method in our Node.js SDK and Rust SDK to see a production-grade implementation of this workflow.1. Build the Initial Transaction
First, gather all the instructions you want to include in your transaction. Then, create aTransaction or VersionedTransaction object. You will also need to fetch a recent blockhash.
This example prepares a versioned transaction. At this stage, you must also sign it so that it can be simulated in the next step.
2. Optimize Compute Unit (CU) Usage
To avoid wasting fees or having your transaction fail, you should set the compute unit (CU) limit as precisely as possible. You can do this by simulating the transaction using thesimulateTransaction RPC method.
It’s a best practice to first simulate with a high CU limit to ensure the simulation itself succeeds, and then use the unitsConsumed from the response to set your actual limit.
3. Set the Right Priority Fee
Next, determine the optimal priority fee to add to your transaction. Using the Helius Priority Fee API is the best way to get a real-time estimate based on current network conditions. You’ll need to call thegetPriorityFeeEstimate RPC method. For the highest chance of inclusion via Helius’s staked connections, use the recommended: true option.
4. Build, Send, and Confirm
Now, assemble the final transaction with the new compute budget instructions, send it, and implement a robust polling mechanism to confirm it has landed. A common pattern is to re-send the same transaction periodically until the blockhash expires. Only re-sign the transaction if you are also fetching a new blockhash. Re-signing with the same blockhash can lead to duplicate transactions being confirmed.Related Methods
sendTransaction
Send a signed transaction to the network
simulateTransaction
Simulate a transaction to estimate compute units
getSignatureStatuses
Check confirmation status of transactions
getLatestBlockhash
Get a recent blockhash for transaction signing
getBlockHeight
Get current block height for expiry checks