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
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.
-
are you sure the contract is not stored? how could a node revialidate tha chain? What about this? cardano.stackexchange.com/questions/24/… Commented May 29, 2021 at 21:19
-
At the top level, there is
block
, which containstransaction_bodies
&transaction_witness_sets
. Similarly, atransaction
containstransaction_body
&transaction_witness_set
.transaction_body
is all about hashes andtransaction_witness_set
enables mapping script hashes to actual scripts. Thetransaction_witness_set
is like a proof that thetransaction_body
is valid. I think a node may choose to delete thetransaction_witness_set
after some time to save space. Commented May 30, 2021 at 4:08