> For the complete documentation index, see [llms.txt](https://docs.cheesecakelabs.com/stellar-plus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheesecakelabs.com/stellar-plus/reference/core/pipelines/simulate-transaction.md).

# Simulate Transaction

<figure><img src="/files/z23J1mELlRXfDzvbE44j" alt="" width="563"><figcaption></figcaption></figure>

Given a transaction object, the Simulate Transaction pipeline will communicate with the RPC server to simulate the transaction execution and receive the simulation parameters. The pipeline will throw an error in case any issues arise when communicating with the RPC server or in case the simulation wasn't successful.

It is important to note that in case any underlying state for this invocation is expired and a restore is required, the simulation will still come back as successful and move forward with the pipeline. In these cases, the output `response` will be of type `SorobanRpc.Api.SimulateTransactionRestoreResponse`.  An [AutoRestore](/stellar-plus/reference/utils/plugins/auto-restore-plugin.md) plugin can be used to automatically perform the restore transaction before exiting the Simulate Transaction pipeline.

For further details on this scenario, refer to Soroban's official documentation on [State Archival](https://soroban.stellar.org/docs/soroban-internals/state-archival).

## Input

```typescript
type SimulateTransactionPipelineInput = {
  transaction: Transaction
  rpcHandler: RpcHandler
}
```

* **transaction**: Transaction to be simulated with the RPC server.
* **rpcHandler**: The RPC handler to be used when communicating with the RPC. Refer to the [RPC](/stellar-plus/reference/rpc.md)section for further details.

## Output

```typescript
type SimulateTransactionPipelineOutput = {
  response: SorobanRpc.Api.SimulateTransactionSuccessResponse | SorobanRpc.Api.SimulateTransactionRestoreResponse
  output?: SimulatedInvocationOutput & ResourcesOutput
  assembledTransaction: Transaction
}
```

* **response**: The successful simulation response from the RPC server. This response might be either of type `SorobanRpc.Api.SimulateTransactionSuccessResponse` or `SorobanRpc.Api.SimulateTransactionRestoreResponse` from[ js-stellar-sdk](https://github.com/stellar/js-stellar-sdk).
* **output**: Optional output to be included by different plugins, attaching specific information to the pipeline output.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.cheesecakelabs.com/stellar-plus/reference/core/pipelines/simulate-transaction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
