Documentation Index
Fetch the complete documentation index at: https://docs.monad.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Summary
The Execution Events and WebSocket features were designed to work together to make Monad even faster for high volume applications. Execution Events is a low-level system, and WebSocket support is one specific usage of that system.Execution Events
Execution Events offers developers the highest performance option for listening to real-time data from the Monad blockchain.- Execution Events uses a shared memory communication system that requires additional setup, which is described here. This setup is not part of the default instructions; it’s only needed if you run real-time data consumers that use the Execution Events feature.
- The “shared memory” nature of the communication means that consumers of execution events must run directly on the same host as the Monad node, so they can observe real-time data in the host’s RAM
-
Monad’s RPC server can optionally use execution events for better
performance, and to support certain features, namely, the
eth_subscribeJSON-RPC call
WebSockets
In Monad’s JSON-RPC server, WebSockets have two uses:- Creating a persistent connection to make JSON-RPC requests
- The ability to call the
eth_subscribeAPI, which will “push” new real-time data as it happens, so you do not need to poll for new events
--ws-enabled. When
--ws-enabled is passed, then the host must be configured to support
execution events, otherwise RPC will exit with an error.
A user guide to WebSockets on Monad is here.
Requirements
- A running Monad full node (setup instructions)
- A
hugetlbfsfilesystem mount- This can be set up using the
hugeadmutility; see below for an example
- This can be set up using the
- Custom (aka “override”)
systemdunit files for bothRPCandExecution- Examples are both below
Setup a hugetlbfs mount using hugeadm
General prerequisites
Install the required package:Execution events SDK prerequisites
If you want to consume real-time data in your own software using the execution events SDK, you must install these additional packages:CLI one-time setup
Sample systemd unit file
This makes the mounts persistent after a reboot.
Create the service file:
Ctrl+O, Enter, Ctrl+X).
Enable and start the service:
Create the event-rings directory
The event-rings directory must exist for WebSocket events to work:Configure the systemd overrides
Important items
systemd:
- As a reminder, if you installed Monad via
apt, thesystemdunit files live in:/usr/lib/systemd/system - This means we need to create a
systemdoverride systemdoverrides for ExecStart (and other additive settings) require two blocks. The first “clears” the original value and the second sets the new value.- You will need to do a
systemctl daemon-reloadafter the changes
events + WebSockets:
RPC+WebSocketshas a HARD dependency onExecutionrunning withevents
WebSockets specific:
- You will need to open a port in your firewall
- The default is
8081 - If you want to use a custom port, the
--ws-port <PORT>forRPCallows you to set the port of your choosing
Configure the Execution override for systemd
This override enables the events sub-component for Execution
You can launch the override editor via:
/etc/systemd/system/monad-execution.service.d/override.conf
File contents (as viewed when using the override editor):
Restart Execution
Adding this step here to ensure that Execution is restarted with the events enabled
Configure the RPC override for systemd
This override enables the WebSockets sub-component for RPC
You can launch the override editor via:
/etc/systemd/system/monad-rpc.service.d/override.conf
File contents:
Restart RPC
Checking the connectivity
A quick way to check if WebSocket connectivity is working is to use a general purpose command-line tool that can act as WebSocket client, such aswebsocat. This is a
powerful command-line “swiss army knife” tool, like nc or the
original socat. It is not officially packaged for Debian/Ubuntu yet,
but precompiled binaries can be downloaded or installed via
cargo install websocat (it is a Rust program).
Here is an example of running it in verbose mode (-v), with the
WebSocket service hosted on default port 8081:
eth_subscribe into your terminal’s stdin and press enter:

