Manage Record Tags
This guide demonstrates how to manage the record tag registry after trail creation: delegating tag management to a dedicated role, adding new tags dynamically, and removing unused tags. Tags that are still referenced by roles or records cannot be removed.
Prerequisites
- Familiarity with using tagged records
Steps
1. Set Up Multiple Wallets
Create an admin wallet, a tag-admin wallet, and a finance-writer wallet to separate tag management from record writing.
Used Utility Functions
2. Create a Trail with an Initial Tag
Start with a trail that has at least one tag in its registry.
3. Delegate Tag Management to a TagAdmin Role
Create a TagAdmin role with AddRecordTags and DeleteRecordTags permissions.
4. Add a New Tag
Add a tag to the registry after trail creation. New tags become immediately available for use in roles and records.
5. Create a Role Scoped to a Tag and Add a Record
Create a role restricted to a specific tag and use it to add a tagged record.
6. Verify In-Use Tags Cannot Be Removed
Attempting to remove a tag that is referenced by a role or record fails.
7. Remove an Unused Tag
Tags that are not referenced by any role or record can be safely removed.
Expected Behavior
- Tags can be added dynamically after trail creation.
- Tags that are in use (referenced by roles or records) cannot be removed.
- Unused tags can be removed from the registry.
- Tag management can be delegated through a dedicated
TagAdminrole.
Running Examples Locally
In order to run the examples, you will need to run an IOTA network locally. See the local network setup guide.
Full Example Code
- Rust
- Typescript (Node.js)
loading...
loading...