I have two nodes (A and B) running as peers on a private network . How can i check if there are pending transactions on one node (suppose Node A ) from node B.

Node A has rpc enabled and rpcport is 8001

I wrote a js snippet for node B `

var Web3 = require('web3');

var web3 = new Web3(new Web3.providers.HttpProvider("http://ipAddress:8001"));

var mining_threads = 1;


function checkWork() {

    if (web3.eth.getBlock("pending").transactions.length > 0) {
        if (eth.mining) return;
    } else {

But this code results in the following error:

err: TypeError: 'XMLHttpRequest' is not a function

And secondly when i log the web3 object above, it shows a property eth which is an object. But this eth object doesnot have pendingTransactions method.

How to fetch the pending transactions from Node A then ?

  • Try to hit 'eth.pendingTransactions' in the terminal
    – Aniket
    Commented Mar 22, 2017 at 7:59


Your Answer

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