1

Currently I'm using GetBlockWithTransactionsByNumber by looping into the latest 200 blocks to get the transactions sent to my address. I can actually get my transaction through the block number but what about the pending transaction which has no block number yet (haven't mined to a block).

enter image description here

0

The txpool_content inspection property can be queried to list the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

Refernce : https://github.com/ethereum/go-ethereum/wiki/Management-APIs#txpool

This API is not directly available.So you can integrate the txpool_content API using the following code.

                  web3.currentProvider.sendAsync({
                         method: "txpool_content",
                         params: [],
                         jsonrpc: "2.0",
                         id: new Date().getTime()
                  }, function(error, result) {
                       console.log(result);
                       if (result.result.pending) {
                            if (result.result.pending[address]) {   //address -external input
                                var txnsCount = 
                               Object.keys(result.result.pending[consumerAddress]).length;
                                 console.log("txnsCount: "+txnsCount);
                            }
                         }
              })
|improve this answer|||||
  • Thanks! I can now get the list of pending transactions using Nethereum's RpcRequest by passing txpool_content method. – doohder Apr 6 '18 at 3:09
  • @doohder Can you please explain/show how you were able to get list of pending transactions using Nethereum? – Vinayak M Nov 29 '18 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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