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).
1 Answer
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);
}
}
})
-
Thanks! I can now get the list of pending transactions using Nethereum's RpcRequest by passing txpool_content method.– doohderApr 6, 2018 at 3:09
-
@doohder Can you please explain/show how you were able to get list of pending transactions using Nethereum? Nov 29, 2018 at 12:06