How to Consume Execution Events in Rust: A Basic Example
This guide walks through building a minimal Rust application that reads execution events from a live Monad node. By the end of this guide, you’ll have a working event consumer that prints each EVM action as it happens.Prerequisites
This guide assumes you have:- A running Monad node with execution events enabled (setup guide)
Project Setup
Here is the repo with the code. Create a new Rust project:Cargo.toml with:
The Code
Replacesrc/main.rs with:
src/main.rs
Build and Run
Expected Output
You’ll see a stream of events as your node processes transactions:Key Concepts
Event Ring
The event ring is a shared memory buffer where the execution daemon writes events. Multiple readers can consume from it simultaneously, each maintaining their own position.EventNextResult
- Ready: An event is available to process
- NotReady: No new events yet (daemon hasn’t written any)
- Gap: Reader fell behind and events were overwritten - call
reset()to recover
Event Types
Common events you’ll see:BlockStart/BlockEnd- Block boundariesTxnHeaderStart/TxnEnd- Transaction boundariesTxnEvmOutput- Transaction execution result (contains receipt with gas_used)TxnLog- EVM log emission (Solidity events)AccountAccess- Account touched during executionStorageAccess- Contract storage read/write
Next Steps
- See the full eventwatch.rs example for production patterns (timestamps, timeout detection, CLI args)
- Read the Rust API docs for detailed type information
- Explore the event ring internals to understand the shared memory protocol

