Skip to main content

WebSocket Connections

Sei supports eth_subscribe over WebSocket. You can subscribe to new blocks, event logs, and pending transactions using standard library WebSocket transports.

Endpoints

Connecting

Watching New Blocks

Watching Contract Events

Watching ERC-20 Transfers Across All Contracts

viem

Notes

  • Sei’s instant finality means every block emitted over WebSocket is already final — no need to wait for additional confirmations before acting on an event.
  • Pending transaction subscriptions (newPendingTransactions) are supported at the RPC level but Sei does not guarantee Ethereum-style pending state visibility.

newHeads Under Autobahn Consensus

When a node runs under Autobahn consensus, eth_subscribe("newHeads") notifications are delivered from an in-process notifier that publishes committed-block headers directly, rather than from the legacy consensus event bus. Subscribers still only observe headers for fully committed blocks, but the header payload differs from the legacy path in a few ways:
  • parentHash, receiptsRoot, and transactionsRoot are returned as zero hashes (0x0000…0000). The Autobahn block-execution path does not build a Tendermint-style hash chain, so there is no meaningful value to surface for these fields.
  • stateRoot is sourced from the finalized block’s AppHash (the post-execution application hash), rather than from a pre-execution header field.
  • hash is the Autobahn block-header hash — the same value reported as blockHash by eth_getBlockByNumber and the receipt APIs, keeping newHeads consistent with the rest of the EVM RPC surface.
  • gasUsed is an approximation (summed from per-transaction results) to keep the notification cheap.
Because of these differences:
  • Subscribers that chain-validate the head stream by linking parentHash values cannot rely on newHeads under Autobahn and need a different mechanism.
  • If you need exact gasUsed or the omitted hash fields, fetch the block explicitly with eth_getBlockByNumber.