> 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/utils/plugins/auto-restore-plugin.md).

# Auto Restore Plugin

<figure><img src="/files/nXiHqltfTPw2HrDlSEub" alt=""><figcaption></figcaption></figure>

The Auto Restore plugin can be used to automatically perform a restore transaction whenever a soroban transaction simulation identifies archived states that would interfere with the transaction execution.

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

* Pipeline Type: [Simulate Transaction](/stellar-plus/reference/core/pipelines/simulate-transaction.md)
* Supported Pipelines:&#x20;
  * [Simulate Transaction](/stellar-plus/reference/core/pipelines/simulate-transaction.md)
  * [Soroban Transaction](/stellar-plus/reference/core/pipelines/soroban-transaction.md) - Targets its inner pipeline.
  * [Classic Transaction](/stellar-plus/reference/core/pipelines/classic-transaction.md)- Targets its inner pipeline.

## Setup

Constructor arguments:

* **restoreTxInvocation**: An object of a Transaction Invocation to parametrize the restore transaction. If a Fee Bump header is present, the transaction will use the [Fee Bump plugin](/stellar-plus/reference/utils/plugins/fee-bump-plugin.md) to wrap the transaction with this header.
* **networkConfig**: A network configuration. Refer to [Network](/stellar-plus/reference/constants.md)
* **customRpcHandler**: An optional custom RPC handler to be used for this transaction.

## postProcess

During the `postProcess` of the Simulate Transaction pipeline, the Auto Restore plugin will verify if the response of the simulation indicates a restore is required. In case yes, it will perform the following steps:

1. Extract the restorePreamble from the simulation
2. Build a restore transaction with its parameters and the restorePreamble
3. Execute the transaction
4. Verify if the original transaction's source was the same as the restore transaction and bumps its sequence number if necessary.

Afterward, the Simulation Pipeline will proceed with the `postProcess` step before exiting.


---

# 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/utils/plugins/auto-restore-plugin.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.
