Skip to main content

Rust: Registry

RegistryClient wraps the NotaRegistry contract and is accessible as the registry field on the Notareum factory: ntm.registry. It registers resources, resolves aliases, revokes records, and computes resource IDs locally. All on-chain methods are async; write methods require the client to be configured with a signer.

Write methods

register_resource

Registers a new resource on-chain and returns the transaction hash as a String:
proof_hash is the keccak256 of the canonical .nota serialization as a 0x-prefixed hex string. Pass None for alias to skip alias assignment.

revoke_resource

Only the current owner may revoke. Revocation flips the is_revoked flag but preserves the record for auditability:

add_resource_type / remove_resource_type

Governance-only. Extend or shrink the governance-managed resource type registry:

Read methods

get_resource

Fetches the full resource record:
ResourceInfo includes owner, resource_type, chain_id, proof_hash, alias, verification_level, registered_at, last_updated_at, and is_revoked.

resolve_alias

Resolves a human-readable alias to the 0x-prefixed bytes32 resource ID:

is_valid_resource_type / get_resource_type_name

Introspect the governance-managed resource type registry:

Utility: compute_resource_id

Derives the resource ID locally, without an RPC call:
The output matches the on-chain derivation exactly, so you can predict the ID before paying gas to register it.

Full example

tiny_keccak and hex are already transitive dependencies of the SDK; you can also reach into notareum::core::crypto for a thin keccak helper instead of pulling them in directly.

See also