Skip to main content
The Event struct represents a TAPLE event, which is the fundamental unit of state change in the system. Events are created, evaluated, and approved before being applied to a subject’s state.

Event Structure

subject_id
DigestIdentifier
required
The identifier of the subject of the event.
event_request
Signed<EventRequest>
required
The signed event request.
sn
u64
required
The sequence number of the event.
gov_version
u64
required
The version of the governance contract.
patch
ValueWrapper
required
The patch to apply to the state (JSON Patch format).
state_hash
DigestIdentifier
required
The hash of the state after applying the patch.
eval_success
bool
required
Whether the evaluation was successful and the result was validated against the schema.
appr_required
bool
required
Whether approval is required for the event to be applied to the state.
approved
bool
required
Whether the event has been approved.
hash_prev_event
DigestIdentifier
required
The hash of the previous event.
evaluators
HashSet<Signature>
required
The set of evaluators who have evaluated the event.
approvers
HashSet<Signature>
required
The set of approvers who have approved the event.

Metadata Structure

The Metadata struct represents the metadata associated with a TAPLE event.
namespace
String
required
The namespace of the event.
subject_id
DigestIdentifier
required
The identifier of the subject of the event.
governance_id
DigestIdentifier
required
The identifier of the governance contract.
governance_version
u64
required
The version of the governance contract.
schema_id
String
required
The identifier of the schema used to validate the event.

Event Lifecycle

  1. Creation - An event is created from an event request
  2. Evaluation - Evaluators validate the event against the schema
  3. Approval - If required, approvers approve or reject the event
  4. Application - The event’s patch is applied to the subject’s state

Example

// Events are typically signed
let signed_event: Signed<Event> = Signed<Event>::from_genesis_request(
    event_request,
    &subject_keys,
    gov_version,
    &init_state,
    derivator,
)?;

// Verify signatures
signed_event.verify_signatures()?;
  • EventRequest - The request that initiated the event
  • Signed<T> - Wrapper for cryptographically signed data
  • DigestIdentifier - Cryptographic identifier
  • Signature - Cryptographic signature

Build docs developers (and LLMs) love