How to send events from contract (fast)

In this blog post, we will discuss a new feature to the existing Michelson language for the Tezos smart contracts. This new feature will allow smart contracts to deliver event messages to off-chain applications by writing event-like data into the transaction receipt in the form of internal operation results. The prominent feature of this is that we define an event emitting instruction, and an event log format that is versatile and expressive.

In addition, having event support in Michelson will avoid manual, duplicating and competing definition of critical parts of event logging systems, so that smart contracts and consumers of events can integrate with each other seamlessly. Historically there has been efforts to emulate this feature using tickets or sending transactions to other smart contracts. This new event logging capability, however, promises to provide a direct, unified and intuitive interface to deliver events with competitive gas prices.

Event messages

First let us define events in smart contracts on Tezos. Events are data written by smart contracts onto the blockchain metadata that are purely for consumption by off-chain applications. It is different from contract storage in the sense that events can be written by a smart contract, but not read by any smart contract including the one composing it. However, off-chain applications such as indexers like Tzkt or your DApp services can observe block header metadata for those event receipts containing data written by a smart contract.

If you want to learn more about this feature, please read our blogpost on Marigold website :point_right: https://www.marigold.dev/post/how-to-send-events-from-contract-fast

6 Likes