Skip to main content

Access Read-Only Methods in Notarizations

Access Read-Only Methods

This guide demonstrates how to use all available read-only methods to inspect and query notarizations. These methods work for both dynamic and locked notarizations and provide comprehensive information about their state, metadata, and configuration.

Prerequisites

  • An existing notarization (dynamic or locked) on the IOTA network
  • Access to a notarization client (read-only access is sufficient)

Available Read-Only Methods

All notarizations support the same comprehensive read-only interface:

  • Content inspection: State, metadata, and description
  • Timestamp queries: Creation and modification times
  • Lock status checking: Transfer, update, and destruction permissions
  • Version tracking: State version counters
  • Method identification: Notarization type detection

1. Set Up Read-Only Client

You can use either a full client or a read-only client for inspection:

examples/utils/utils.rs
loading...

2. Create Test Notarizations

Create both dynamic and locked notarizations for comprehensive testing:

examples/08_access_read_only_methods.rs
loading...

Content and Metadata Inspection

3. Read Description and Metadata

Access the immutable description and updatable metadata:

examples/08_access_read_only_methods.rs
loading...

4. Read Current State

Access the current state content and its metadata:

examples/08_access_read_only_methods.rs
loading...

Timestamp Queries

5. Get Creation and Modification Times

Query when the notarization was created and last modified:

examples/08_access_read_only_methods.rs
loading...

Version and Type Information

6. Get Version Count and Method Type

Check the state version counter and notarization method:

examples/08_access_read_only_methods.rs
loading...

Lock Status Checking

7. Check All Lock Statuses

Verify transfer, update, and destruction permissions:

examples/08_access_read_only_methods.rs
loading...

8. Get Lock Metadata

Access detailed information about applied locks:

examples/08_access_read_only_methods.rs
loading...

Demonstrating Version Tracking

9. Update State and Show Version Changes

For dynamic notarizations, demonstrate how version tracking works:

examples/08_access_read_only_methods.rs
loading...

Read-Only Methods Summary

MethodReturnsDescription
description()StringImmutable description set at creation
updatable_metadata()Option<String>Current updatable metadata
state()StateCurrent state content and metadata
created_at_ts()u64Creation timestamp
last_state_change_ts()u64Last state modification timestamp
state_version_count()u64Number of state updates
notarization_method()NotarizationMethodDynamic or Locked
is_transfer_locked()boolWhether transfers are blocked
is_update_locked()boolWhether updates are blocked
is_destroy_allowed()boolWhether destruction is allowed
lock_metadata()Option<LockingMetadata>Detailed lock information

Use Cases for Read-Only Methods

Auditing and Compliance

  • Verify immutability: Check that locked notarizations haven't changed
  • Track modifications: Monitor version counts and timestamps
  • Compliance checking: Verify lock status for regulatory requirements

Integration and Automation

  • Status monitoring: Check lock status before operations
  • Content verification: Validate state and metadata
  • Type detection: Handle dynamic and locked notarizations differently

User Interfaces

  • Display information: Show content, metadata, and status
  • Permission checking: Enable/disable UI actions based on locks
  • History tracking: Display version information and timestamps

Full Example Code

examples/08_access_read_only_methods.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.