I would like to verify if somebody send ETH to a particular address. How can I get the list of incoming (pending) transactions with web3 ?

I tried the example in the web3 documentation with subscribe(“pendingTransactions”):


var subscription = web3.eth.subscribe('pendingTransactions', function(error, result){
    if (!error)
.on("data", function(transaction){

But I get the following error: TypeError: web3.eth.subscribe is not a function

Is there a way to get that list ?

  • OR: how etherscan can create this page: ropsten.etherscan.io/txsPending ?
    – jfjobidon
    Commented Aug 12, 2017 at 0:54
  • My guess is you were using web3 0.x and reading the documentation for web3 1.0
    – neuhaus
    Commented Dec 12, 2017 at 11:53

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 helps~

  • 2
    Great works! Is it however possible to limit this to only pending transactions on a specific contract address?
    – riper
    Commented Mar 20, 2018 at 22:13
  • 2
    This doesn't work with the 1.0 API
    – Shamoon
    Commented May 10, 2018 at 19:54

You have to create web3 with websocket provider given by full-nodes. For example,

const webSocketProvider = new Web3.providers.WebsocketProvider('ws://');
const web3Ws = new Web3(webSocketProvider);

In this example, I create a web3 with websocket provider listening to full-nodes websocket on my localhost. After that, web3.eth.subscribe will be valid.

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.