Update! I have my node running with geth --rpcapi txpool --rpc

var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('')); console.log(web3.txpool);

I still receive



web3.eth.extend({   property: 'txpool',   methods: [{
    name: 'content',
    call: 'txpool_content'   },{
    name: 'inspect',
    call: 'txpool_inspect'   },{
    name: 'status',
    call: 'txpool_status'   }] });

I am still getting only { pending: '0x0', queued: '0x0' }

How can this be? I'd expected hundreds of transactions.

  • 2
    I think you're confusing Python and JavaScript. The documentation you're reading is for a Python library, but you seem to be writing JavaScript code.
    – user19510
    Jun 29, 2018 at 20:29
  • @carver I tried the solutions proposed there... but it is not working out
    – igotBAWS
    Jun 29, 2018 at 21:20
  • 1
    If there are no good answers to an existing question, creating another question just adds noise. Try upvoting that question, commenting on it, or even clarifying the question with an update.
    – carver
    Jun 29, 2018 at 21:23
  • Solved by waiting for eth.syncing
    – igotBAWS
    Jul 3, 2018 at 22:43

2 Answers 2


When you run your node you must doit with --rpcapi txpool

  • I think you are right, I am just trying to figure out how to use the data which I am getting by starting the node this way.
    – igotBAWS
    Jun 29, 2018 at 20:33
  • I tried var Web3 = require('web3'); var Web4 = require('web3'); web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/Whm5Ks3VGzJMBGHh4MEx')); var web4 = new Web4(Web4.givenProvider || "ws://localhost:8546");, However, console.log(web4.txpool); still gives me undefined
    – igotBAWS
    Jun 29, 2018 at 20:39
  • I tried geth --rpcapi txpool --rpc together with web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); and geth --wsapi txpool --ws together with var web3 = new Web3(Web3.givenProvider || 'ws://some.local-or-remote.node:8546'); Doesn't work for me
    – igotBAWS
    Jun 29, 2018 at 21:19
  • try with geth --rpc --rpcapi txpool,web3,net,eth Jul 9, 2018 at 21:15

The web3.py docs (for connecting with Python) are not interchangeable for web3.js docs (for connecting with JavaScript). They have different APIs.

Web3.js appears to not have a built-in mechanism for querying transaction pool (likely because the geth and parity approaches are different). See this answer for adding your own pool API: How to access to txpool within a web3 script?

  • 1
    I did this, however I don't get any results. Updated my post to reflect this
    – igotBAWS
    Jun 29, 2018 at 23:03

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