newFlashblocks
Subscribe via eth_subscribe to receive full block state updates as each Flashblock is built. Each message contains the accumulated pre-confirmed state for the block in progress.
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 Flashblock object per WebSocket message, with events arriving roughly every 200ms. If your handler does heavy work per event, throttle or debounce it to avoid blocking.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
subscriptionType | string | Yes | Must be "newFlashblocks". |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
result | string | Hex-encoded subscription ID. Each event notification delivers a Flashblock object — not a standard block object. The payload contains payload_id, index, diff, and (on index 0) base. See the infrastructure stream schema for the full structure. |
Example
Section titled “Example”Subscribe
Section titled “Subscribe”{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newFlashblocks"]}Subscription ID response
Section titled “Subscription ID response”{"jsonrpc": "2.0", "id": 1, "result": "0x3b8cd9e5f4a7b2c1d0e3f4a5b6c7d8e9"}JavaScript
Section titled “JavaScript”import WebSocket from 'ws';
// Use a WebSocket-enabled node provider endpointconst ws = new WebSocket('wss://your-provider-endpoint');
ws.on('open', () => { ws.send(JSON.stringify({ jsonrpc: '2.0', method: 'eth_subscribe', params: ['newFlashblocks'], id: 1 }));});
ws.on('message', (data) => { const msg = JSON.parse(data.toString()); if (msg.method === 'eth_subscription') { // Fires every ~200ms with the latest Flashblock state console.log('Flashblock update:', msg.params.result); }});