Decode a Michelson EMIT event from an operation receipt

Tezos contract events appear among internal operations. A decoder needs the emitting contract, event tag, type and payload to interpret an event correctly.

Match the event and its contract

For the instruction below, a successful invocation can emit a nat value under the tag filled. Inspect the included operation receipt, select the internal event emitted by the expected contract, and decode the payload according to the event type.

EMIT %filled nat

A payload containing the Micheline integer 3 means the contract emitted the number three. Its unit and meaning come from the contract interface. Another contract can use the same tag for unrelated data.

Confirm the operation survived execution

EMIT creates an operation that the contract must return for the event to be delivered. Also inspect the enclosing manager group for backtracking. Use block identity and operation position when storing several events sharing the same tag. octez.tezos.com Octez protocol documentation