<p>For one thing, the validator script associated with a smart contract is not stored on the blockchain; the blockchain only stores the hash just like for a lot of other things. When the code of the validator script changes, the script address also changes, but because the script is not stored on the blockchain, the cost of abandoning a smart contract is like that of abandoning a regular address.</p>
<p>So, there will be no blockchain storage problems with having a lot of unused smart contracts, no more than with having a lot of abandoned regular addresses, and the requirement that each UTXO contains at least a certain amount of ADA limits the number of addresses with non-zero balance.</p>
<p>To avoid losing assets, the developer should move the balance from the old script address to the new script address when he updates the validator script though that may not always be securely feasible without giving the developer/maintainer too much centralized power over the smart contract's operations.</p>
<p>However, someone may build an off-chain metadata service that allows registering validator scripts to facilitate lookups by hash and such a service may accumulate junk and get storage problems unless they address the issue.</p>

CC BY-SA 4.0
2021-05-29T21:19:06.513Z
are you sure the contract is not stored? how could a node revialidate tha chain? What about this? https://cardano.stackexchange.com/questions/24/how-can-a-node-verify-a-transaction-with-a-script-address-without-the-script
wutzebaer
CC BY-SA 4.0
2021-05-30T04:08:59.637Z
At the top level, there is `block`, which contains `transaction_bodies` & `transaction_witness_sets`. Similarly, a `transaction` contains `transaction_body` & `transaction_witness_set`. `transaction_body` is all about hashes and `transaction_witness_set` enables mapping script hashes to actual scripts. The `transaction_witness_set` is like a proof that the `transaction_body` is valid. I think a node may choose to delete the `transaction_witness_set` after some time to save space.
Joshua Chia
CC BY-SA 4.0
2021-05-27T15:59:21.090Z
2021-05-27T16:11:14.720Z
2021-05-27T16:11:14.720Z
Joshua Chia
<p>How will unused, outdated smart contracts be handled? Or say a developer makes a mistake in the contract and needs to redeploy it, what happens to that old contract? Would a lot of Unused contracts cause a lot problems for storage?</p>

<smart-contract>
How are unused/outdated smart contracts handled on Cardano?
# How are unused/outdated smart contracts handled on Cardano?

(Asked by: username_0 on 2021-05-25)

How will unused, outdated smart contracts be handled? Or say a developer makes a mistake in the contract and needs to redeploy it, what happens to that old contract? Would a lot of Unused contracts cause a lot problems for storage?

**Tags:** smart-contract

---

## 1 answers

### Answer by username_1 on 2021-05-27. Score: 5

For one thing, the validator script associated with a smart contract is not stored on the blockchain; the blockchain only stores the hash just like for a lot of other things. When the code of the validator script changes, the script address also changes, but because the script is not stored on the blockchain, the cost of abandoning a smart contract is like that of abandoning a regular address.

So, there will be no blockchain storage problems with having a lot of unused smart contracts, no more than with having a lot of abandoned regular addresses, and the requirement that each UTXO contains at least a certain amount of ADA limits the number of addresses with non-zero balance.

To avoid losing assets, the developer should move the balance from the old script address to the new script address when he updates the validator script though that may not always be securely feasible without giving the developer/maintainer too much centralized power over the smart contract's operations.

However, someone may build an off-chain metadata service that allows registering validator scripts to facilitate lookups by hash and such a service may accumulate junk and get storage problems unless they address the issue.

> **Comments:**
> **username_2**: are you sure the contract is not stored? how could a node revialidate tha chain? What about this? https://cardano.stackexchange.com/questions/24/how-can-a-node-verify-a-transaction-with-a-script-address-without-the-script  
> **username_1**: At the top level, there is `block`, which contains `transaction_bodies` & `transaction_witness_sets`. Similarly, a `transaction` contains `transaction_body` & `transaction_witness_set`. `transaction_body` is all about hashes and `transaction_witness_set` enables mapping script hashes to actual scripts. The `transaction_witness_set` is like a proof that the `transaction_body` is valid. I think a node may choose to delete the `transaction_witness_set` after some time to save space.  

---

