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
- Sufficient funds for gas costs
- Understanding of the notarization's delete 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: Cannot be destroyed (permanent record)
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.
2. Create a Locked Notarization with No Delete Lock
First, let's create a locked notarization that can be destroyed immediately:
3. Check Destruction Permission
Before attempting to destroy, check if destruction is allowed:
4. Destroy the Unlocked Notarization
Destroy the locked notarization with no delete lock (should succeed):
Time-Locked Notarization Scenario
Time-locked notarizations cannot be destroyed until their delete lock expires:
5. Create a Time-Locked Notarization
6. Attempt to Destroy Time-Locked Notarization
Delete Lock Scenarios Summary
Delete Lock | Can Destroy? | When? | Notes |
---|---|---|---|
TimeLock::None | ✅ Yes | Immediately | No restrictions |
TimeLock::UnlockAt(future) | ❌ No | After timestamp | Must wait for expiration |
TimeLock::UnlockAt(past) | ✅ Yes | Immediately | Lock has expired |
TimeLock::UntilDestroyed | ❌ Never | Never | Permanent record |
Comparison with Dynamic Notarizations
Feature | Locked Notarization | Dynamic Notarization |
---|---|---|
Destruction control | Delete locks | Transfer locks |
Default behavior | May have restrictions | Usually destroyable |
Lock purpose | Preserve immutable records | Control ownership transfers |
Typical use case | Compliance, legal records | Evolving documents |
Error Handling
Destruction attempts may fail due to:
- Active delete locks: Time-locked notarizations before expiration
- Permanent locks:
UntilDestroyed
locks prevent all destruction - 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 delete lock status: Always verify with
is_destroy_allowed()
before attempting - Understand lock types: Know the delete lock configuration before creation
- Plan for compliance: Use appropriate delete locks for regulatory requirements
- Consider permanence: Use
UntilDestroyed
for truly permanent records - Backup critical data: Ensure important content is preserved elsewhere
Full Example Code
The complete example demonstrates various destruction scenarios for locked notarizations:
- 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.