Skip to main content

Create a Locked Notarization

Create a Locked Notarization

This guide will walk you through the process of creating a Locked Notarization and publishing it to an IOTA network. Locked notarizations are immutable and non-transferable, making them ideal for permanent records and compliance scenarios.

Key Characteristics of Locked Notarizations

  • Immutable: State and metadata cannot be changed after creation
  • Non-transferable: Cannot be transferred to other addresses
  • Delete locks: Support time-based destruction restrictions
  • Permanent record: Provides immutable document notarization until the Delete Lock expires

In the current implementation, it isn't possible to create infinitely permanent records with Locked Notarizations. The delete lock must either be set to None (allowing immediate deletion) or to UnlockAt(timestamp) (restricting deletion until a specified time). This design ensures that storage deposits can be reclaimed in the future. To have a nearly infinitely permanent record choose a very distant future timestamp for the delete lock.

1. Get Funded Notarization Client

To create a Locked Notarization, you need access to an IOTA network or run a local IOTA network.

In test networks as well as local ones, you can use a faucet to request funds. In the IOTA mainnet you will need an address with enough funds to cover the gas cost of the whole procedure.

tip

If you want to use the main IOTA network, you will need an address with actual IOTA funds to create a new Locked Notarization.

The example code below demonstrates using a faucet to receive funds before the example code is run.

This is how to create a notarization client and call a utility function explained below to fund the test account.

examples/utils/utils.rs
loading...

The utility function to fund the test account is implemented this way:

product_common/src/test_utils/utils.rs
loading...
fn unpack_command_output(output: &Output, task: &str) -> anyhow::Result<String> {
let stdout = std::str::from_utf8(&output.stdout)?;
if !output.status.success() {
let stderr = std::str::from_utf8(&output.stderr)?;
anyhow::bail!("Failed to {task}: {stdout}, {stderr}");
}

Ok(stdout.to_string())
}
note

2. Create a Locked Notarization with Delete Lock

The NotarizationClient uses the builder pattern to create a new Locked Notarization object with delete lock controls.

examples/01_create_locked_notarization.rs
loading...
note
  • The build_and_execute() (resp. buildAndExecute()) method is called to publish the Locked Notarization.
  • The finish() method is called to build the transaction which will create the Locked Notarization when being processed by an IOTA node.

End Result

The end result will be a Locked Notarization object that is published to the IOTA network with the following characteristics:

  • Immutable content: State and metadata cannot be modified
  • Non-transferable: Ownership cannot be changed
  • Delete protection: Controlled by the specified delete lock
  • Permanent record: Ideal for compliance and audit requirements

Delete Lock Types

Locked notarizations support different delete lock options:

  • None: Can be destroyed immediately after creation
  • UnlockAt(timestamp): Cannot be destroyed until specified timestamp
  • UntilDestroyed: This option can not be used for delete locks

Use Cases for Locked Notarizations

  • Regulatory compliance: Documents that must remain unchanged
  • Legal records: Court documents, contracts, certifications
  • Audit trails: Immutable records for compliance purposes

Long-term Archival

  • Historical records: Documents of historical significance
  • Academic research: Research data that must remain unaltered
  • Digital preservation: Long-term storage of important documents

Trust and Verification

  • Certificates: Educational or professional certifications
  • Attestations: Third-party verifications
  • Timestamps: Proof of existence at specific times

Full Example Code

examples/01_create_locked_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.