<ul>
<li>Make a statemachine with a transition &quot;Update&quot;.</li>
<li>Use <code>Constraints</code> (or otherwise, eg <code>check</code>) to layout in which contexts an &quot;Upgrade&quot; is permissible. For example &quot;must be signed by my special key&quot;.</li>
<li>Make the upgrade target state a final state (<code>isFinal s == True</code>)</li>
</ul>
<p>Et voila. You have &quot;upgraded&quot; your statemachine.</p>
<p>Obvs cardano validators are immutable - you can't upgrade them in the &quot;mutate a thing&quot; way</p>

CC BY-SA 4.0
2022-04-10T03:31:00.150Z
Thanks! Your approach will finish the current validator. I think additionally the update transition has to explicitly guarantee the creation of an UTxO sitting on the updated validator, to ensure the updated validator will be available.
Qin
CC BY-SA 4.0
2022-04-09T13:37:16.627Z
2022-04-09T13:37:16.627Z
waalge
<p>I wonder if it is possible to design a State Machine that has a special state transition that can upgrade the State Machine, meaning creating a new UTxO sitting at a new script address (instead of the old script address), representing the upgraded State Machine. After the upgrade, future transactions will be validated using the new State Machine.</p>
<p>I am not sure if this upgrading functionality is achievable using State Machine. If so, how can it be achieved?</p>

<statemachines>
Is it possible to upgrade a State Machine?
# Is it possible to upgrade a State Machine?

(Asked by: username_0 on 2022-04-09)

I wonder if it is possible to design a State Machine that has a special state transition that can upgrade the State Machine, meaning creating a new UTxO sitting at a new script address (instead of the old script address), representing the upgraded State Machine. After the upgrade, future transactions will be validated using the new State Machine.

I am not sure if this upgrading functionality is achievable using State Machine. If so, how can it be achieved?

**Tags:** statemachines

---

## 1 answers

### Answer by username_1 on 2022-04-09. Score: 1 | Accepted answer

* Make a statemachine with a transition "Update".
* Use `Constraints` (or otherwise, eg `check`) to layout in which contexts an "Upgrade" is permissible. For example "must be signed by my special key".
* Make the upgrade target state a final state (`isFinal s == True`)

Et voila. You have "upgraded" your statemachine.

Obvs cardano validators are immutable - you can't upgrade them in the "mutate a thing" way

> **Comments:**
> **username_0**: Thanks! Your approach will finish the current validator. I think additionally the update transition has to explicitly guarantee the creation of an UTxO sitting on the updated validator, to ensure the updated validator will be available.  

---

