Skip to content
BaseHub by wbnns Updated

pendingLogs

Subscribe via eth_subscribe to receive logs from pre-confirmed transactions matching an optional filter. Useful for monitoring contract events with sub-block latency.

This subscription needs a WebSocket-enabled endpoint. The public Base endpoints (mainnet.base.org, sepolia.base.org) are HTTP only, so connect through a node provider such as Alchemy or QuickNode that offers WebSocket support for Base.

Requires base/base minimum client version v0.3.1.

Each subscription emits one item per WebSocket message, with events arriving roughly every 200ms. If your handler does heavy work per event, throttle or debounce it to avoid blocking.

NameTypeRequiredDescription
subscriptionTypestringYesMust be "pendingLogs".
filterOptionsobjectNoOptional log filter.

The filterOptions object accepts:

FieldTypeDescription
addressstring | arrayA single contract address or array of addresses to filter by.
topicsarrayArray of topic filters in the same format as eth_getLogs.
FieldTypeDescription
resultstringHex-encoded subscription ID.
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_subscribe",
"params": [
"pendingLogs",
{
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}
]
}
{"jsonrpc": "2.0", "id": 1, "result": "0x2a7bc8d4e3f5a6b1c2d3e4f5a6b7c8d9"}