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).
Asked
Active
Viewed 2,220 times
1
Shane Fontaine
- 18,036
- 20
- 54
- 82
doohder
- 23
- 4
1 Answers
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);
}
}
})
Crissi Mariam Robert
- 1,174
- 1
- 9
- 25
-
Thanks! I can now get the list of pending transactions using Nethereum's RpcRequest by passing txpool_content method. – doohder Apr 06 '18 at 03: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
