Retrieving Pending Transactions

Is it possible to use Moralis to retrieve pending transactions before it is confirmed?
If so how?

It is possible to use something like this in order to subscribe to pendingTransactions:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="[email protected]/dist/web3.min.js"></script>
const options = {
  // Enable auto reconnection
  reconnect: {
      auto: true,
      delay: 5000, // ms
      maxAttempts: 5,
      onTimeout: false


    var web3 = new Web3(new Web3.providers.WebsocketProvider("wss://", options));

     function task() {
      let subscription = web3.eth.subscribe("pendingTransactions", function (
      ) {
        if (result) {
        } else if (error) {


hello @cryptokid
is it possible to get only the current pending transactions? without subscribing?

so I want to check if there is any pending transactions at the moment, if there are check them, if there are not skip

is it better to subscribe then unsubscribe?


I dont think that there will be one case on the current supported blockchains where there is not one single pending transaction.

Subscribing is the best (and I think the only) option!

if you know exactly what transaction hash you want to check, you could check it if it pending or validated
or if you use Moralis db you may have your specific transactions in Pending specific table when they are pending

1 Like