Skip to main content

Destroy Dynamic Notarization

Destroy Dynamic Notarizations

This guide demonstrates how to destroy Dynamic Notarizations and explains the different scenarios based on lock status. Dynamic notarizations can be destroyed under certain conditions depending on their transfer locks.

Prerequisites

  • A Dynamic Notarization owned by your address
  • Sufficient funds for gas costs
  • Understanding of the notarization's lock status

Understanding Destruction Rules

Dynamic notarizations follow these destruction rules:

  • Unlocked: Can be destroyed immediately
  • Transfer-locked: Cannot be destroyed while locked
  • Time-locked: Can be destroyed after lock expires
warning

Once destroyed, a notarization cannot be recovered. Ensure you really want to delete it permanently.

1. Get the Notarization Client

First, ensure you have a funded notarization client with ownership of the notarization.

examples/utils/utils.rs
loading...

2. Create an Unlocked Dynamic Notarization

First, let's create an unlocked dynamic notarization that can be destroyed immediately:

examples/04_destroy_notarization.rs
loading...

3. Check Destruction Permission

Before attempting to destroy a notarization, check if it's allowed:

examples/04_destroy_notarization.rs
loading...

4. Destroy the Unlocked Notarization

Destroy the unlocked notarization (should succeed):

examples/04_destroy_notarization.rs
loading...

Transfer-Locked Notarization Scenario

Transfer-locked notarizations cannot be destroyed while the lock is active:

5. Create a Transfer-Locked Notarization

examples/04_destroy_notarization.rs
loading...

6. Attempt to Destroy Transfer-Locked Notarization

examples/04_destroy_notarization.rs
loading...

Destruction Scenarios Summary

Lock StatusCan Destroy?Notes
No locks✅ YesImmediate destruction allowed
Transfer lock (active)❌ NoMust wait for lock to expire
Transfer lock (expired)✅ YesCan destroy after expiration
UntilDestroyed lock❌ NoCannot destroy while this lock exists

Error Handling

Destruction operations may fail due to:

  • Active transfer locks: Transfer-locked notarizations cannot be destroyed
  • 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 destruction status: Always verify with is_destroy_allowed() before attempting
  2. Handle errors gracefully: Implement proper error handling for failed destruction
  3. Consider lock expiration: For time-locked notarizations, wait for expiration
  4. Backup important data: Ensure you have copies of important notarized content
  5. Confirm Notarization is destroyed: Check the network to confirm the notarization is destroyed

Full Example Code

The complete example demonstrates various destruction scenarios:

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.