> For the complete documentation index, see [llms.txt](https://docs.catalog.cat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.catalog.cat/technical-manual/catalog/the-refund-action.md).

# The Refund Action

Something went wrong - but worry not, you can get your funds back.

*Note*: The refund action code can be found [here](https://github.com/Yakuhito/slot-machine/blob/master/rue-puzzles/actions/catalog/refund.rue) ([Chialisp](https://github.com/Yakuhito/slot-machine/blob/master/puzzles/actions/catalog/refund.clsp)). The SDK driver is [`CatalogRefundAction`](https://github.com/xch-dev/chia-wallet-sdk/blob/main/crates/chia-sdk-driver/src/layers/action_layer/actions/catalog/refund.rs).

Registering an entry in CATalog requires two transactions. First, a user must create a precommitment coin. Second, after waiting for `relative_block_height` blocks (typically 32 on mainnet), the user needs to interact with the registry, which checks (spends) their precommitment coin.

During the period between the two actions, it is possible that the precommitment becomes invalid. This would happen if:

* The CAT maker puzzle of the registry changes (e.g., the price singleton updated the payment CAT to a different asset, so the precommitment coin is now in the wrong CAT)
* The precommitment amount is wrong (e.g., the price singleton changed the registration price)
* The TAIL hash has been registered

When refunding, the action sends `SendMessage` with message `0` (refund mode) to return the precommit CAT to the refund puzzle hash.

If the TAIL is already registered but the precommit is otherwise invalid, the refund action also spends and recreates the existing slot with `counter + 1`.

The action also creates a puzzle announcement. This announcement can be asserted to ensure the dApp singleton is running the right action with the right parameters. For the refund action, the announcement prefix, `'$'`, is concatenated to `(sha256tree (tail_hash . initial_nft_owner_ph))`.

The CLI exposes refunds via `catalog register --refund` (same command as registration, different code path). See [CLI Reference](/technical-manual/cli.md).

*Written by* [*yakuhito*](https://x.com/yakuhito) *from* [*FireAcademy.io*](https://fireacademy.io/) *on Feb 14th, 2025.*


---

# 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.catalog.cat/technical-manual/catalog/the-refund-action.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.
