Skip to main content
Base API method that streams event logs from pre-confirmed transactions matching an optional filter. Events arrive approximately every 200ms—one item per WebSocket message. This subscription type is exclusive to Flashblocks-enabled endpoints. See Flashblocks on Base for background on how Flashblocks work.

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • string — the subscription type, pendingLogs in this case.
  • object — (optional) the log filter options:
    • address — the contract address from which the logs should be fetched. It can be a single address or an array of addresses.
    • topics — an array of DATA topics. The event topics for which the logs should be fetched. It can be a single topic or an array of topics. Uses the same topic filter format as eth_getLogs.
      Read Tracking some Bored Apes: The Ethereum event logs tutorial to learn more about topics and event logs.

Response

  • subscription — the subscription ID.
  • object — a log object matching the specified filter:
    • address — the contract address from which the event originated.
    • topics — an array of 32-byte data fields containing indexed event parameters.
    • data — the non-indexed data that was emitted along with the event.
    • blocknumber — the block number in which the event was included. null if it is pending.
    • transactionhash — the hash of the transaction that triggered the event. null if pending.
    • transactionindex — the integer index of the transaction within the block’s list of transactions. null if it is pending.
    • blockhash — the hash of the block in which the event was included. Set to 0x0000...0000 for pre-confirmed events.
    • blocktimestamp — the Unix timestamp of the block (hex).
    • logindex — the integer identifying the index of the event within the block’s list of events. null if pending.
    • removed — the boolean value indicating if the event was removed from the blockchain due to a chain reorganization. True if the log was removed. False if it is a valid log.

eth_subscribe("pendingLogs") code examples

Note that subscriptions require a WebSocket connection and WebSocket cat for you to use this method in the console.Install WebSocket cat with:npm install -g wscat
In the following examples, we subscribe to USDC transfer events on Base. The address 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 is the Base USDC contract and 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef is the Transfer(address,address,uint256) event signature.
$ wscat -c YOUR_CHAINSTACK_WEBSOCKET_ENDPOINT
# Wait for the connection to be established

Connected (press CTRL+C to quit)

> {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["pendingLogs",{"address":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}
This will generate a continuous stream of data displaying event logs from pre-confirmed transactions matching the filter. Use eth_unsubscribe | Base to remove the subscription.

Use case

The eth_subscribe("pendingLogs") method is useful in scenarios where you need to react to specific smart contract events with sub-second latency:
  • DeFi monitoring. Track swap events on DEXs like Uniswap or Aerodrome as soon as they are pre-confirmed, giving you ~1.8 seconds of advance notice compared to waiting for the full 2-second block to seal. This is valuable for arbitrage detection, liquidity monitoring, and price feed updates.
  • Real-time token transfer tracking. Monitor ERC-20 transfers (such as USDC or WETH) for specific addresses or contracts as they happen, enabling faster notifications for wallets, payment processors, and compliance tools.
  • Smart contract event indexing. Event indexers can begin processing logs from pre-confirmed transactions instead of waiting for finalized blocks, reducing the end-to-end latency of on-chain data pipelines.
Last modified on April 1, 2026