Skip to main content
Each subscription emits one item per WebSocket message. Events arrive approximately every 200ms. If your application performs heavy processing per event, throttle or debounce your handler to avoid blocking.
Subscribe to receive full block state updates as each Flashblock is built. Each message contains the accumulated preconfirmed state for the block in progress.
This method is only available on Flashblocks-aware endpoints. Connect to https://mainnet-preconf.base.org (or https://sepolia-preconf.base.org) to use it.
Requires base/base minimum client version v0.3.1.

Parameters

subscriptionType
string
required
Must be "newFlashblocks".

Returns

result
string
Hex-encoded subscription ID.

Example

{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newFlashblocks"]}
JavaScript example:
import WebSocket from 'ws';

// Use a WSS RPC endpoint — not the raw Flashblock WebSocket stream
const ws = new WebSocket('wss://your-provider.example.com/ws');

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_subscribe',
    params: ['newFlashblockTransactions'],
    id: 1
  }));
});

ws.on('message', (data) => {
  const response = JSON.parse(data.toString());
  if (response.method === 'eth_subscription') {
    console.log('Preconfirmed transaction:', response.params.result);
  }
});

ws.on('error', (error) => {
  console.error('WebSocket error:', error);
});

ws.on('close', () => {
  console.log('WebSocket connection closed');
});