simulateTransaction
Simulates sending a transaction. This performs all the same checks as sendTransaction (signature verification, balance checks, program execution) without actually submitting the transaction to the cluster. It returns the execution result including logs, compute units consumed, and any errors. This is invaluable for transaction debugging, fee estimation, validating transaction construction, and pre-flight checks before committing real transactions.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Transaction as an encoded string. Must be base-64 encoded |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
encoding | string | Encoding of the transaction: base64 (default base64) |
sigVerify | bool | If true, verify transaction signatures (default false; conflicts with replaceRecentBlockhash) |
replaceRecentBlockhash | bool | If true, replace the transaction's blockhash with the latest (default false) |
accounts | object | Accounts configuration: { addresses: string[], encoding: string } |
minContextSlot | number | Minimum slot at which the request can be evaluated |
innerInstructions | bool | If true, include inner instructions in the response |
Response
Returns an RpcResponse object:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the simulation was evaluated |
value.err | `object | null` |
value.logs | `array[string] | null` |
value.accounts | `array | null` |
value.unitsConsumed | u64 | Number of compute units consumed during simulation |
value.returnData | `object | null` |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk2TIQ0/jAgPDtfEP82jE2NpNsAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSbxFRHKFUzK0X+2KniPE+eNjjVy10Ezz0o5/SCCr73AQIAAQA=",
{
"encoding": "base64",
"replaceRecentBlockhash": true
}
]
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "simulateTransaction",
params: [
"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk2TIQ0/jAgPDtfEP82jE2NpNsAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSbxFRHKFUzK0X+2KniPE+eNjjVy10Ezz0o5/SCCr73AQIAAQA=",
{
encoding: "base64",
replaceRecentBlockhash: true
}
]
}),
});
const { result } = await response.json();
console.log("Simulation:", result.value.err ? "Failed" : "Success", "CU:", result.value.unitsConsumed);Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk2TIQ0/jAgPDtfEP82jE2NpNsAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSbxFRHKFUzK0X+2KniPE+eNjjVy10Ezz0o5/SCCr73AQIAAQA=",
{
"encoding": "base64",
"replaceRecentBlockhash": True
}
]
})
result = response.json()["result"]
print(f"Simulation: {'Failed' if result['value']['err'] else 'Success'}, CU: {result['value']['unitsConsumed']}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk2TIQ0/jAgPDtfEP82jE2NpNsAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSbxFRHKFUzK0X+2KniPE+eNjjVy10Ezz0o5/SCCr73AQIAAQA=",
{
"encoding": "base64",
"replaceRecentBlockhash": true
}
]
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 166974442 },
"value": {
"err": null,
"logs": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"accounts": null,
"unitsConsumed": 150,
"returnData": null
}
},
"id": 1
}