1

I want to count nonce include pending transactions as following.

Tx1 nonce=0 succeed
Tx2 nonce=1 pending
Tx3 nonce=2 pending
Tx3 nonce=3 pending

I am using api provided by etherscan, but it just returns nonce for only confirmed transactions. How can I get nonce include pending transactions?

0

It's only possible to have a trustable transaction count including transactions already added to a block and mined, so on the chain. Otherwise the the tx are not known from the networks and etherscan can't tell about them. Pending means not in any block yet. However, if you run your own node or have an rpc access to a node that provides the eth_getTransactionCount method, you can get the count including the transaction pool. Pool is the list of tx to be included in a block but not in the block yet. Of course it's not completely reliable (if someone sends a tx from the same account to another node) but I think it's the best you can get.

| improve this answer | |

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.