[Ethereum] Watch pending transaction from all nodes in network

go-ethereumtransactionstxpool

I have two geth nodes in my own private netwrok: nodeA and nodeB. When iam sending transaction from nodeA, i am able to see this transaction in pending pool after call method txpool.content if i have access to nodeA. But is it possible to get txpool from nodeA if i have access only to nodeB? And how i can watch all pending txpool from all nodes?

Best Answer

The transaction pool is something internal to the node. In geth, there is a web3 extension to query it remotely via JSON RPC. See https://github.com/ethereum/go-ethereum/blob/master/internal/web3ext/web3ext.go (TxPool_JS).

You'll have to directly use JSON RPC (enable with -rpcapi txpool):

E.g.:

curl -X POST --data '{"jsonrpc":"2.0","method":"txpool_content","params":[],"id":1}' http://localhost:8545

{"jsonrpc":"2.0","id":1,"result":{"pending":{},"queued":{}}}

Complete method list is:

  • txpool_content
  • txpool_inspect
  • txpool_status
Related Topic