Skip to main content

Destroy Locked Notarization

Destroy Locked Notarizations​

This guide demonstrates how to destroy Locked Notarizations based on their delete lock configuration. Unlike dynamic notarizations, locked notarizations have special destruction rules based on their delete locks.

Prerequisites​

  • A Locked Notarization owned by your address
  • Understanding of the notarization's lock status

Understanding Delete Lock Rules​

Locked notarizations follow these destruction rules based on their delete locks:

  • TimeLock::None: Can be destroyed immediately
  • TimeLock::UnlockAt(timestamp): Can only be destroyed after the specified timestamp
  • TimeLock::UntilDestroyed: This option can not be used for delete locks
warning

Once destroyed, a locked notarization cannot be recovered. This is permanent deletion.

1. Get the Notarization Client​

First, ensure you have a funded notarization client with ownership of the notarization. See Get Funded Notarization Client for used utility functions.

examples/utils/utils.rs
loading...

2. Create a Locked Notarization with No Delete Lock​

First, let's create a locked notarization that can be destroyed immediately:

examples/04_destroy_notarization.rs
loading...

3. Check Destruction Permission​

Before attempting to destroy, check if destruction is allowed:

examples/04_destroy_notarization.rs
loading...

4. Destroy the Unlocked Notarization​

Destroy the locked notarization with no delete lock (should succeed):

examples/04_destroy_notarization.rs
loading...

Time-Locked Notarization Scenario​

Time-locked notarizations cannot be destroyed until their delete lock expires:

5. Create a Time-Locked Notarization​

examples/04_destroy_notarization.rs
loading...

6. Attempt to Destroy Time-Locked Notarization​

examples/04_destroy_notarization.rs
loading...

Delete Lock Scenarios Summary​

Delete LockCan Destroy?When?Notes
TimeLock::None✅ YesImmediatelyNo restrictions
TimeLock::UnlockAt(future)❌ NoAfter timestampMust wait for expiration
TimeLock::UnlockAt(past)✅ YesImmediatelyLock has expired
TimeLock::UntilDestroyed--Can not be used for delete locks

Comparison with Dynamic Notarizations​

FeatureLocked NotarizationDynamic Notarization
Destruction controlDelete locksTransfer locks
Default behaviorMay have restrictionsUsually destroyable
Lock purposePreserve immutable recordsControl ownership transfers
Typical use caseCompliance, legal recordsEvolving documents

Error Handling​

Destruction attempts may fail due to:

  • Active delete locks: Time-locked notarizations before expiration
  • Insufficient funds: Not enough gas to complete the transaction
  • Ownership: Only the current owner can destroy the notarization
  • Network issues: Connectivity or node problems

Best Practices​

  1. Check delete lock status: Always verify with is_destroy_allowed() before attempting
  2. Understand lock types: Know the delete lock configuration before creation
  3. Plan for compliance: Use appropriate delete locks for regulatory requirements
  4. Backup critical data: Ensure important content is preserved elsewhere

Full Example Code​

The complete example demonstrates various destruction scenarios for locked notarizations:

examples/04_destroy_notarization.rs
loading...

Running Examples Locally​

In order to run the examples, you will need to run an IOTA network locally.

If you want to use something different, you will need to modify the API and faucet endpoints in the examples to match your setup.