Skip to main content

Overview

The ZKScore Trust Registry contract emits events for all attestation lifecycle activities, schema registration, and trust score updates. These events enable real-time monitoring and off-chain indexing of the trust graph.
Events provide a complete audit trail of all trust-related activities and are essential for building trust analytics and reputation systems.

Attestation Events

Attested

Emitted when a new attestation is created.
Parameters:
  • recipient (address indexed): Attestation recipient
  • attester (address indexed): Who created the attestation
  • uid (bytes32): Unique attestation identifier
  • schema (bytes32 indexed): Schema used
When Emitted:
  • When attest() is successfully called
  • During batch attestation operations
Example Usage:

Revoked

Emitted when an attestation is revoked.
Parameters:
  • recipient (address indexed): Original attestation recipient
  • attester (address indexed): Who revoked the attestation
  • uid (bytes32): Attestation identifier
  • schema (bytes32 indexed): Schema used
When Emitted:
  • When revoke() is successfully called
  • During batch revocation operations
Example Usage:

Schema Events

SchemaRegistered

Emitted when a new schema is registered.
Parameters:
  • uid (bytes32 indexed): Schema unique identifier
  • registerer (address indexed): Who registered the schema
When Emitted:
  • When registerSchema() is successfully called
Example Usage:

Trust Module Events

TrustModuleRegistered

Emitted when a trust evaluation module is registered.
Parameters:
  • module (address indexed): Module contract address
  • name (string): Module name
When Emitted:
  • When a new trust module is registered

TrustScoreUpdated

Emitted when a userโ€™s trust score changes.
Parameters:
  • subject (address indexed): User whose score changed
  • oldScore (uint256): Previous trust score
  • newScore (uint256): New trust score
When Emitted:
  • When trust score is recalculated
  • After attestation creation/revocation

Event Monitoring

Comprehensive Trust Monitor

Event Analytics

Trust Graph Analysis

Best Practices

Event Handling

  1. Use Indexed Parameters: Filter efficiently using indexed fields
  2. Store Event Data: Cache important events off-chain
  3. Monitor Continuously: Set up real-time listeners
  4. Handle Reorgs: Account for blockchain reorganizations
  5. Rate Limiting: Donโ€™t overwhelm with event processing

Performance

  1. Limit Block Ranges: Query smaller ranges to avoid timeouts
  2. Pagination: Implement pagination for large datasets
  3. Batch Processing: Process events in batches
  4. Caching: Cache frequently accessed event data
  5. Indexing: Use subgraphs or custom indexers