Mempool
Mempool observes the pending stage of a submitted transaction, before it is included in a block, through subscriptions or polling. You can subscribe to pending transactions over WebSocket, or create a filter and periodically query new pending transactions.
If you cannot check the state between submission and block inclusion, it is hard to distinguish a pending transaction from one that failed to be sent. With Mempool observation, you can detect long-pending transactions early and decide whether to submit a replacement transaction with a higher fee.
Use Cases
- Service OpsStatus guidance right after submission
When a customer inquiry arrives right after a withdrawal, look up the transaction with eth_getTransactionByHash. If it is returned but blockNumber is empty, treat it as pending. Subscriptions and filters only receive transactions after registration, so check the status of a specific transaction with a lookup.
- Withdrawal OpsEarly detection of pending transactions
Detect withdrawals that stay in the pending stage for a long time before they are included in a block. You can decide whether to submit a replacement transaction with a higher fee.
- Service OpsShow expected deposits
Detect pending transactions sent to a customer address and display them as expected deposits. Reflect the balance only after block inclusion and finality.