getTransactionCount Pending Transactions Not Recognized

Hi Infura Team,

I’m currently using Infura (mainnet) and the “eth_getTransactionCount” rpc endpoint to fetch the nonce for my next transaction. I’m passing “pending” as my block parameter to make sure the pending transactions are included in the transaction count, which has worked for me in the past. However at the moment, even though I have a pending transaction in my wallet this is not recognized and the call only returns the next nonce for the mined transactions. Because I’m developing a wallet application this effectively means that when there is a pending transaction present in the mining queue, the next transaction will overwrite this pending transaction instead of adding it to the queue.

Both:

curl --location --request POST 'https://mainnet.infura.io/v3/<API_KEY>' \
--header 'Content-Type: text/plain' \
--data-raw '{"method":"eth_getTransactionCount","params":["0x17e8af19a0029e5b8128154c5c4a89e861ed449e","pending"],"id":54,"jsonrpc":"2.0"}'

and

curl --location --request POST 'https://mainnet.infura.io/v3/<API_KEY>' \
--header 'Content-Type: text/plain' \
--data-raw '{"method":"eth_getTransactionCount","params":["0x17e8af19a0029e5b8128154c5c4a89e861ed449e","latest"],"id":55,"jsonrpc":"2.0"}'

are returning the same result even though pending transactions are present in my wallet. I guess the pending transactions are only available locally for the node so should you be able to rely on a correct pending transaction count? Thanks in advance for your help!

Hi @janschmutz, and welcome to the Infura community!
You should be able to submit the transaction and have the correct nonce show up; the only reason it wouldn’t happen is if it’s been routed to another node. Hope this helps!