0

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?

1 Answer 1

1
  • 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

1
  • 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
    Apr 10, 2022 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.