> 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;
