simulateTransaction
Solana node API
simulateTransaction | Solana
The Solana simulateTransaction method simulates sending a transaction. Reference for simulateTransaction on Solana via Chainstack.
POST
simulateTransaction
The Solana
simulateTransaction method simulates sending a transaction. This method does not send a transaction, but rather runs the transaction and returns the result of the execution.
This method is useful for predicting how a transaction will affect the state of the blockchain without actually committing any changes. It can be used to estimate transaction fees, check for potential errors, and understand the effects of a transaction before sending it.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
transaction(string, required) — a base64 or base58 encoded string representing the transaction to simulate.config(object, optional) — configuration object containing:encoding(string) — encoding used for the transaction data. Values:base58(deprecated),base64(recommended). Default:base58.commitment(string) — the bank state to simulate against. Default:finalized.sigVerify(boolean) — whentrue, verify transaction signatures. Default:false. Conflicts withreplaceRecentBlockhash.replaceRecentBlockhash(boolean) — whentrue, replace the transaction’s recent blockhash with the most recent blockhash from the bank. Default:false. Useful for simulating transactions with expired blockhashes. Conflicts withsigVerify.minContextSlot(integer) — the minimum slot at which the request can be evaluated.innerInstructions(boolean) — whentrue, include inner instructions in the response. Default:false.accounts(object) — configuration for returning post-simulation account state:addresses(array of strings) — array of account addresses to return.encoding(string) — encoding for the returned account data. Values:base64,base64+zstd,jsonParsed.
Response
The response includes aresult object with:
err— null if the simulation was successful, otherwise a transaction error object.logs(array of strings) — log messages the transaction produced during simulation.unitsConsumed(u64) — number of compute units consumed by the transaction.accounts— an array of account objects (or null) corresponding to theaccounts.addressesrequest field.returnData— data returned by the last program that invokedsol_set_return_data. ContainsprogramId(string) anddata([base64_string, "base64"]tuple).innerInstructions— array of inner instruction sets (wheninnerInstructions: truein the request). Each set containsindex(the instruction index) andinstructions(array of inner instruction objects).fee(u64, nullable) — the transaction fee in lamports.preBalances(array of u64) — account balances before the simulation.postBalances(array of u64) — account balances after the simulation.preTokenBalances— token balances before the simulation.postTokenBalances— token balances after the simulation.loadedAddresses— addresses loaded from address lookup tables. Containswritable(array of strings) andreadonly(array of strings).replacementBlockhash— present whenreplaceRecentBlockhash: true. Containsblockhash(string) andlastValidBlockHeight(u64).
Use case
A common use case forsimulateTransaction is to estimate compute units, predict fee costs, and verify that a transaction will succeed before submitting it via sendTransaction. This is especially useful for:
- Estimating the exact compute units needed to set via
ComputeBudgetProgram.setComputeUnitLimit - Debugging failed transactions by inspecting
logsandinnerInstructions - Previewing token balance changes with
preTokenBalancesandpostTokenBalances - Checking post-execution account state via the
accountsconfig
Last modified on May 18, 2026