Events are objects that contain information about the execution of the application. They are
mainly used by service providers like block explorers and wallet to track the execution of various
messages and index transactions.
# Pre-requisite Readings
# Subscribing to Events
# Cosmos and Tendermint Events
Check the Tendermint Websocket in the Clients documentation for reference.
It is possible to subscribe to
Events via Tendermint's Websocket (opens new window).
This is done by calling the
subscribe RPC method via Websocket:
These events are triggered after a block is committed. You can get the full list of
event categories and values here.
attribute value of the
query allow you to filter the specific
event you are
looking for. For example, a an Ethereum transaction on Evmos (
MsgEthereumTx) triggers an
event of type
attributes. Subscribing to this
event would be done like so:
hexAddress is an Ethereum hex address (eg:
# Ethereum Events
Under the hood, it uses the Tendermint RPC client's event system to process subscriptions that are then formatted to Ethereum-compatible events.
Then you can check if the state changes with the
eth_getFilterChanges (opens new window) call:
# Websocket Connection
# Tendermint Websocket
To start a connection with the Tendermint websocket you need to define the address with the
flag when starting the node (default
Then, start a websocket subscription with ws (opens new window)
# Ethereum Websocket
Since Evmos runs uses Tendermint Core as it's consensus Engine and it's built with the Cosmos SDK framework, it inherits the event format from them. However, in order to support the native Web3 compatibility for websockets of the Ethereum's PubSubAPI (opens new window), Evmos needs to cast the Tendermint responses retrieved into the Ethereum types.
You can start a connection with the Ethereum websocket using the
--json-rpc.ws-address flag when starting
the node (default
Then, start a websocket subscription with
ws (opens new window)