simulateTransaction
Last updated:
`simulateTransaction` runs a transaction against the current bank state and returns the result it *would* produce if submitted, without ever broadcasting it. Use it to pre-flight a transaction: confirm it would succeed, read the program logs it would emit, measure the compute units it would consume, and inspect the post-execution state of selected accounts.
This is the right call before `sendTransaction` when you want to surface errors to the user, estimate a compute-unit budget, or decode a program's return data without paying fees. Because simulation reflects live bank state, the result is advisory — a transaction that simulates cleanly can still fail on submission if state changes in the interim.
By default the transaction's recent blockhash must be valid for simulation to succeed. Set `replaceRecentBlockhash: true` to have the node substitute the most recent blockhash before simulating, which lets you simulate a transaction whose own blockhash has already expired.
> **Tier note:** this method belongs to the `sol_sim_bundle` category and is > available on **pro and business tiers only**. Free- and basic-tier keys > receive a `-32002` tier-insufficient error.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| transaction | string | Yes | |
| config | SimulateTransactionConfig | No |
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"simulateTransaction","params":["<transaction>","<config>"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "simulateTransaction",
"params": [
"<transaction>",
"<config>"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"simulateTransaction","params":["<transaction>","<config>"],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 5 per call.
FAQ
- What does simulateTransaction do?
- Simulates sending a Solana transaction without submitting it to the cluster, returning the would-be execution result, logs, and compute usage.
- How many credits does simulateTransaction cost?
- simulateTransaction costs 5 credit(s) per call on Triport by default.
- Is simulateTransaction available over WebSocket?
- simulateTransaction is an HTTP JSON-RPC method.