Why a transaction can not read events?

To execute a transaction, there is no need to read previous events,but why make a limit on it?

To draw an analogy to a conventional program:

Running a program produces persistent outputs (e.g., changes to the file system), temporary outputs (e.g., stdout and stderr), and intermediate states that are not outputs at all (e.g., the program state in the middle of main). The Libra blockchain also has these three concepts. Events map to temporary outputs in this analogy and are useful for the same reason that (e.g.) printing is useful.

If a transaction could read events, an event stream with events of type E would be identical to an immutable vector of E's, and the concept of temporary outputs would disappear. That would be fine, but it is useful to have a write-only output buffer for notifying the outside world of important happenings. This is what Libra uses events for.

1 Like

Thanks for the clear explanation!