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
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.
2. Create an Unlocked Dynamic Notarization
First, let's create an unlocked dynamic notarization that can be destroyed immediately:
3. Check Destruction Permission
Before attempting to destroy a notarization, check if it's allowed:
4. Destroy the Unlocked Notarization
Destroy the unlocked notarization (should succeed):
Transfer-Locked Notarization Scenario
Transfer-locked notarizations cannot be destroyed while the lock is active:
5. Create a Transfer-Locked Notarization
6. Attempt to Destroy Transfer-Locked Notarization
Destruction Scenarios Summary
Lock Status | Can Destroy? | Notes |
---|---|---|
No locks | ✅ Yes | Immediate destruction allowed |
Transfer lock (active) | ❌ No | Must wait for lock to expire |
Transfer lock (expired) | ✅ Yes | Can destroy after expiration |
UntilDestroyed lock | ❌ No | Cannot 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
- Check destruction status: Always verify with
is_destroy_allowed()
before attempting - Handle errors gracefully: Implement proper error handling for failed destruction
- Consider lock expiration: For time-locked notarizations, wait for expiration
- Backup important data: Ensure you have copies of important notarized content
- Confirm Notarization is destroyed: Check the network to confirm the notarization is destroyed
Full Example Code
The complete example demonstrates various destruction scenarios:
- Rust
- Typescript (Node.js)
loading...
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.