I use Infura to get all pending transactions from Ropsten:

web3.eth.subscribe('pendingTransactions', async (error, txHash) => {
    let tx = getTransaction(txHash)

With this subscription, I receive only the transaction hashes, so I must make a request to get each transaction.

My question: is there a way to receive the full pending transactions with a simple subscription ?

2 Answers 2


There is a filter function in web3 javascript API and you can get pending txs by it. A simple print script as follows:

        if (!error) {
    } )

Hope It will Help You...

  • 1
    with Infura, I got this error: web3.eth.filter is not a function
    – jfjobidon
    Sep 30, 2019 at 20:32
  • and with web3.eth.subscribe('pending', ...) I got: Unknown subscription: pending
    – jfjobidon
    Sep 30, 2019 at 20:35
  • It appears you are using web3.js v1.0 and make sure you are using callback with the subscribe method. For more see web3js.readthedocs.io/en/v1.2.0/… Oct 1, 2019 at 12:14

Right, the pendingTransactions event returns only hashes, but you can optimize the further tx retrieval by creating the batched request with web3js#batchrequest. Wait for N new pending transactions (aka tx pool), and request the transactions data at once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.