Skip to main content
Events allow smart contracts to emit structured data about important state changes. They’re essential for indexing, notifications, and building responsive applications.

Event Basics

Events in Move must have the copy and drop abilities:

Real Example: NFT Events

From examples/move/nft:

Game Events Example

From examples/move/hero:

Event Design Patterns

State Change Events

Track important state transitions:

Transfer Events

Financial Events

Multiple Events

Emit multiple events in one transaction:

Event Indexing

Events can be queried using the Sui SDK:

Rust SDK

From crates/sui-sdk/examples/event_api.rs:

TypeScript SDK

Event Filtering

By Move Event Type

By Package

By Module

By Sender

Best Practices

1. Include relevant identifiers

2. Add timestamps when useful

3. Use descriptive event names

4. Keep events focused

5. Document event usage

Common Event Patterns

Creation/Deletion Events

Before/After Events

Multi-step Process Events

Testing Events

Events are emitted during tests but can’t be directly inspected in unit tests. Test the side effects instead:

Next Steps