# Contract Upgrades

**URL:** <https://forum.canton.network/t/contract-upgrades/4188>\
**Category:** App Development\
**Tags:** daml, upgrading, upgrade\
**Created:** [March 23, 2022, 2:33pm UTC](https://forum.canton.network/t/contract-upgrades/4188 "2022-03-23T14:33:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [March 23, 2022, 2:33pm UTC](https://forum.canton.network/t/contract-upgrades/4188/1 "2022-03-23T14:33:36Z")

</div>

Hello all,

Is there a way to exclude certain packages from ledger after a migration process has been concluded?  
For example, if we were to have templates `V1.Foo` and `V2.Foo`, deployed from different `.dar`'s, could we wipe the package that included the first templateId off of the ledger?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stephen/32/102_2.png) [@Stephen](https://forum.canton.network/u/Stephen)\
**Post date:** [March 24, 2022, 3:10pm UTC](https://forum.canton.network/t/contract-upgrades/4188/2 "2022-03-24T15:10:09Z")

</div>

This is generally not possible in the Daml Ledger model, because a `V1.Foo` continues to be part of the chain of transactions that led to the creation of the associated `V2.Foo`. Even archived contracts must have their associated dars in order to remain valid.

I can imagine a number of (nonexistent) features that would satisfy various motivations (i.e. “why, not how”). Hiding package IDs from JSON API, withdrawing permission to create new contracts for particular templates, and so on. In this case, what would your motivation be?

---

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [March 25, 2022, 9:10am UTC](https://forum.canton.network/t/contract-upgrades/4188/3 "2022-03-25T09:10:31Z")

</div>

In this particular context, I believe that simply hiding “replaced” packages would suffice, in order for the packageId of the template not having to be explicitly known, at the time of a request.

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stephen/32/102_2.png) [@Stephen](https://forum.canton.network/u/Stephen)\
**Post date:** [March 29, 2022, 1:49pm UTC](https://forum.canton.network/t/contract-upgrades/4188/4 "2022-03-29T13:49:57Z")

</div>

Assuming what you have in mind is JSON-API specific, I created [an issue for further discussion of that feature idea. Please subscribe to it for any updates in the future.](https://github.com/digital-asset/daml/issues/13447)

I should add that, for production applications, we strongly encourage using the package IDs with JSON API; package ID inference is great for prototyping, but masks potential version mismatches in production, which is why all codegens use explicit package ID specification.
