# simulateTransaction

Simulate sending a transaction.

#### Parameters required for this RPC call

* Transaction, as an encoded string.
* The amount of lamports to airdrop
* **configuration object**: This contains the following parameters. All optional.
  * **encoding**: Encoding used for the transaction data. Values: `base58` (*slow*, **DEPRECATED**), or `base64`.
  * **commitment**: Commitment level to simulate the transaction at. See [Configuring State Commitment](https://solana.com/docs/rpc/index.mdx#configuring-state-commitment). Default `finalized`.
  * **replaceRecentBlockhash**: If `true` the transaction recent blockhash will be replaced with the most recent blockhash (conflicts with `sigVerify`)
  * **sigVerify**: If `true` the transaction signatures will be verified (conflicts with `replaceRecentBlockhash`)
  * **innerInstructions**: If `true` the response will include [inner instructions](https://solana.com/docs/rpc/json-structures#inner-instructions). These inner instructions will be `jsonParsed` where possible, otherwise `json`.
  * **accounts**: If `true` the response will include [inner instructions](https://solana.com/docs/rpc/json-structures#inner-instructions). These inner instructions will be `jsonParsed` where possible, otherwise `json`.
  * **minContextSlot**: Set the minimum slot at which to perform preflight transaction checks.

{% tabs %}
{% tab title="cURL" %}

<pre class="language-bash"><code class="lang-bash">curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
<strong>  POST -H "Content-Type: application/json" -d ' 
</strong>   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "simulateTransaction",
     "params": [
       "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEEjNmKiZGiOtSZ+g0//wH5kEQo3+UzictY+KlLV8hjXcs44M/Xnr+1SlZsqS6cFMQc46yj9PIsxqkycxJmXT+veJjIvefX4nhY9rY+B5qreeqTHu4mG6Xtxr5udn4MN8PnBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/zamQ6EeyeeVDvPVgUO2W3Lgt9hT+CfyqHvIa11egFPCgEDAwIBAAkDZAAAAAAAAAA=",
       {
         "commitment": "confirmed",
         "encoding": "base64",
         "replaceRecentBlockhash": true
       }
     ]
   }
 '
</code></pre>

{% endtab %}

{% tab title="Web3.js" %}

```javascript
import {
  Connection,
  VersionedTransaction,
  clusterApiUrl,
  type SimulateTransactionConfig,
} from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");

const base64Tx =
  "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEEjNmKiZGiOtSZ+g0//wH5kEQo3+UzictY+KlLV8hjXcs44M/Xnr+1SlZsqS6cFMQc46yj9PIsxqkycxJmXT+veJjIvefX4nhY9rY+B5qreeqTHu4mG6Xtxr5udn4MN8PnBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/zamQ6EeyeeVDvPVgUO2W3Lgt9hT+CfyqHvIa11egFPCgEDAwIBAAkDZAAAAAAAAAA=";

let tx = VersionedTransaction.deserialize(Buffer.from(base64Tx, "base64"));

let simulateTxConfig: SimulateTransactionConfig = {
  commitment: "finalized",
  replaceRecentBlockhash: true,
  sigVerify: false,
  minContextSlot: undefined,
  innerInstructions: undefined,
  accounts: undefined,
};

let simulateResult = await connection.simulateTransaction(tx, simulateTxConfig);

console.log(simulateResult);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.3.3",
      "slot": 393226680
    },
    "value": {
      "accounts": null,
      "err": null,
      "innerInstructions": null,
      "loadedAccountsDataSize": 413,
      "logs": [
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [1]",
        "Program log: Instruction: Transfer",
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1714 of 200000 compute units",
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success"
      ],
      "replacementBlockhash": {
        "blockhash": "6oFLsE7kmgJx9PjR4R63VRNtpAVJ648gCTr3nq5Hihit",
        "lastValidBlockHeight": 381186895
      },
      "returnData": null,
      "unitsConsumed": 1714
    }
  },
  "id": 1
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shyft.to/solana/rpc-calls/http/simulatetransaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
