6

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?

1 Answer 1

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.

2
  • are you sure the contract is not stored? how could a node revialidate tha chain? What about this? cardano.stackexchange.com/questions/24/…
    – wutzebaer
    Commented May 29, 2021 at 21:19
  • 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. Commented May 30, 2021 at 4:08

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.