> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.chainstack.com/feedback

```json
{
  "path": "/reference/base-subscribe-pendinglogs",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# eth_subscribe pendingLogs | Base

> Base API method that streams filtered event logs from pre-confirmed Flashblock transactions, delivering events approximately every 200ms.

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](/docs/flashblocks-on-base) for background on how Flashblocks work.

<Check>
  ### Get your own node endpoint today

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## 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](/reference/base-getlogs).

    <Info>
      Read [Tracking some Bored Apes: The Ethereum event logs tutorial](/docs/tracking-some-bored-apes-the-ethereum-event-logs-tutorial) to learn more about topics and event logs.
    </Info>

## 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

<Info>
  Note that subscriptions require a WebSocket connection and [WebSocket cat](https://www.npmjs.com/package/wscat) for you to use this method in the console.

  Install WebSocket cat with:

  `npm install -g wscat`
</Info>

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.

<CodeGroup>
  ```shell wscat theme={"system"}
  $ 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"]}]}
  ```

  ```javascript javascript theme={"system"}
  const WebSocket = require('ws');

  const webSocket = new WebSocket('CHAINSTACK_WSS_URL');

  async function subscribeToPendingLogs() {

    const request = {
      id: 1,
      jsonrpc: '2.0',
      method: 'eth_subscribe',
      params: ['pendingLogs', {
        address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
        topics: ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef']
      }],
    };

    const onOpen = (event) => {
      webSocket.send(JSON.stringify(request));
    };

    const onMessage = (event) => {
      const response = JSON.parse(event.data);
      console.log(response);
    };

    try {
      webSocket.addEventListener('open', onOpen);
      webSocket.addEventListener('message', onMessage);
    } catch (error) {
      console.error(error);
    }
  }

  subscribeToPendingLogs();
  ```
</CodeGroup>

This will generate a continuous stream of data displaying event logs from pre-confirmed transactions matching the filter.

Use [eth\_unsubscribe | Base](/reference/base-unsubscribe) 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.
