About sequence_number and event_index in events.proto

What’s the difference between sequence_number and event_index in file “events.proto”?

message Event {
    uint64 sequence_number = 2;
}
message EventWithProof {
  uint64 transaction_version = 1;
  uint64 event_index = 2;
}

Good question.

  • Each event is emitted from a given handle (e.g., received_events in LibraAccount). A handle keeps track of how many events it has emitted. The sequence_number in message Event is this number (e.g., "this is the ith event emitted by the event handle key").
  • Each transaction keeps a log of the events that were emitted during its execution. The event_index in EventProof is the position of the given event in this log (e.g., "this is the ith event emitted by the transaction at version").
2 Likes

It helps me a lot, thanks.