Skip to main content

Audit Trails Events

Audit Trails emit on-chain events for the operations that change a trail's state. Events let off-chain systems observe and react to trail activity — building dashboards, triggering notifications, feeding indexers, or maintaining the off-chain capability registry that the denylist model relies on.

Every event carries the ObjectID of the AuditTrail object it relates to, so consumers can filter the event stream per trail. Events that result from a user action also record the address that performed it and a millisecond timestamp.

info

Every operation that changes a trail's persistent state emits an event — including locking-configuration changes, metadata updates, record-tag registry changes, and package migration. Read-only operations, such as reading records or inspecting roles and capabilities, emit nothing.


Event Overview

EventEmitted whenTriggering operation
AuditTrailCreatedA new AuditTrail object is createdCreate an Audit Trail
AuditTrailDeletedAn AuditTrail object is destroyedDelete an Audit Trail
AuditTrailMigratedA trail is migrated to the current package versionPackage migration
MetadataUpdatedThe trail's mutable metadata is updatedUpdate metadata
LockingConfigUpdatedThe trail's locking configuration is updatedConfigure locking
RecordAddedA record is appended to the trailAdd a record
RecordDeletedA record is removed from the trailDelete records
RecordTagAddedA record tag is added to the trail's registryManage record tags
RecordTagRemovedA record tag is removed from the trail's registryManage record tags
RoleCreatedA new role is added to the trailManage access control
RoleUpdatedA role's permissions or tag allowlist changeManage access control
RoleDeletedA role is removed from the trailManage access control
CapabilityIssuedA capability is issued for a roleManage access control
CapabilityRevokedA capability is added to the revoked-capability denylistManage access control
CapabilityDestroyedA capability object is destroyedManage access control
RevokedCapabilitiesCleanedUpExpired entries are pruned from the denylistManage access control

The exact payload types are available in the Wasm API reference.


Trail Lifecycle Events

AuditTrailCreated

Emitted once when a new AuditTrail object is created.

FieldDescription
trail_idObjectID of the newly created trail.
creatorAddress that created the trail.
timestampMillisecond event timestamp.

AuditTrailDeleted

Emitted when an AuditTrail object is destroyed. A trail can only be deleted once all of its records have been removed and the delete_trail_lock has expired.

FieldDescription
trail_idObjectID of the deleted trail.
timestampMillisecond event timestamp.

AuditTrailMigrated

Emitted when a trail is migrated to the current package version after a package upgrade.

FieldDescription
trail_idObjectID of the migrated trail.
migrated_byAddress that migrated the trail.
timestampMillisecond event timestamp.

Trail Configuration Events

MetadataUpdated

Emitted when the trail's mutable metadata field is replaced or cleared.

FieldDescription
trail_idObjectID of the trail whose metadata changed.
updated_byAddress that updated the metadata.
timestampMillisecond event timestamp.

LockingConfigUpdated

Emitted when any part of the trail's locking configuration changes — the locking config as a whole, the delete_record_window, the delete_trail_lock, or the write_lock. Each of these operations emits a single LockingConfigUpdated event.

FieldDescription
trail_idObjectID of the trail whose locking configuration changed.
updated_byAddress that updated the locking configuration.
timestampMillisecond event timestamp.

Record Events

RecordAdded

Emitted each time a record is appended to the trail.

FieldDescription
trail_idObjectID of the trail receiving the record.
sequence_numberSequence number assigned to the new record.
added_byAddress that added the record.
timestampMillisecond event timestamp.

RecordDeleted

Emitted each time a record is removed. A batch deletion emits one RecordDeleted event per deleted record, not a single aggregate event.

FieldDescription
trail_idObjectID of the trail the record was deleted from.
sequence_numberSequence number of the deleted record.
deleted_byAddress that deleted the record.
timestampMillisecond event timestamp.

Record Tag Events

Record tags are managed through the trail's tag registry. See Manage Record Tags for how tags are added, removed, and applied to records.

RecordTagAdded

Emitted when a record tag is added to the trail's tag registry.

FieldDescription
trail_idObjectID of the trail whose registry changed.
added_byAddress that added the tag.
timestampMillisecond event timestamp.

RecordTagRemoved

Emitted when a record tag is removed from the trail's tag registry.

FieldDescription
trail_idObjectID of the trail whose registry changed.
removed_byAddress that removed the tag.
timestampMillisecond event timestamp.

Role Events

Roles and capabilities are managed by the access-control registry. See Role-Based Access Control for how these concepts fit together.

RoleCreated

Emitted when a new role is added to the trail.

FieldDescription
trail_idObjectID of the trail that owns the role.
roleRole name.
permissionsPermission set granted by the new role.
dataOptional RoleTags allowlist restricting which tagged records the role can operate on.
created_byAddress that created the role.
timestampMillisecond event timestamp.

RoleUpdated

Emitted when an existing role's permission set or its RoleTags allowlist changes.

FieldDescription
trail_idObjectID of the trail that owns the role.
roleRole name.
permissionsUpdated permission set for the role.
dataUpdated RoleTags allowlist, if any.
updated_byAddress that updated the role.
timestampMillisecond event timestamp.

RoleDeleted

Emitted when a role is removed from the trail.

FieldDescription
trail_idObjectID of the trail that owned the role.
roleRole name.
deleted_byAddress that deleted the role.
timestampMillisecond event timestamp.

Capability Events

CapabilityIssued

Emitted when a capability is issued for a role.

FieldDescription
target_keyObjectID of the trail the capability is valid for.
capability_idObjectID of the newly created capability.
roleRole granted by the capability.
issued_toAddress the capability is bound to, if any.
valid_fromMillisecond timestamp before which the capability is not yet active, if set.
valid_untilMillisecond timestamp after which the capability expires, if set.

CapabilityRevoked

Emitted when a capability is added to the revoked-capability denylist. Revoking the initial admin capability emits this event as well.

FieldDescription
target_keyObjectID of the trail the capability was valid for.
capability_idObjectID of the revoked capability.
valid_untilMillisecond timestamp retained for denylist cleanup (0 means "no expiry — keep indefinitely").

CapabilityDestroyed

Emitted when a capability object is destroyed. Destroying the initial admin capability emits this event as well.

FieldDescription
target_keyObjectID of the trail the capability was valid for.
capability_idObjectID of the destroyed capability.
roleRole the capability granted.
issued_toAddress that held the capability, if any.
valid_fromMillisecond timestamp at which the capability became valid, if set.
valid_untilMillisecond timestamp at which the capability expired, if set.

RevokedCapabilitiesCleanedUp

Emitted when a cleanup operation prunes expired entries from the revoked-capability denylist.

FieldDescription
trail_idObjectID of the trail whose denylist was pruned.
cleaned_countNumber of expired entries removed by this call.
cleaned_byAddress that triggered the cleanup.
timestampMillisecond event timestamp.