1

geth version 1.8.27

The pending nonce is 8 at first, then I send a transaction and use eth.getTransactionCount to get the next pending nonce.

> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9

I have two questions:
1. I use txpool.content.pending and see there's a tx in the pending list(nonce=8). But eth.getTransactionCount still return 8 and after a while, it return 9.

  1. Why eth.getTransactionCount still return a 8 when it returned 9 last time? (shown in the log above)

1 Answer 1

2
  1. Before you perform a transaction there is a total of 8 transactions. When you do another transaction then there is total 9 transaction(8 Confirmed & 1 Pending). Therefore eth.getTransactionCount returns 9.
  2. When a transaction is confirmed on the blockchain, it will take some times to reflect on the block. At this time transaction is not in pending state and also not added to block. That's why for a moment eth.getTransactionCount returns 8.
2
  • That's a bug of eth.getTransactionCount
    – yjjjnls
    Jun 4, 2019 at 8:43
  • That's not a bug, it's a nature of ethereum blockchain and that is how it works. Jun 4, 2019 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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