Skip to content

Events

Move events serve the same product purpose as Solidity events: signal important on-chain state changes to off-chain readers.

event MessageAdded(address sender, string message, uint256 addedAt);
#[event]
struct MessageAdded has drop, store {
sender: address,
message: String,
added_at: u64,
}
emit MessageAdded(sender, message, block.timestamp);
event::emit(MessageAdded {
sender,
message,
added_at: timestamp::now_seconds(),
});

Move events are first-class structs. That gives you a cleaner typed model, and they can be queried later through the Indexer or transaction APIs depending on the use case.