0

How to get the new nonce of from address using web3? There shouldn't be any transaction associated with this. Is there any way to get this.

1 Answer 1

1

You can get the transaction count (nonce) of any address using web3.eth.getTransactionCount('address') as explained in web3 documentation

Hope this helps

3
  • But this method won't give the correct transaction count, there may be possible that some transactions are already initiated but not gets complete. So, in this case, the count values would not be updated.
    – Shubham
    Commented Jun 6, 2018 at 11:53
  • I do not understand what are you expecting to get, the function will give you the transaction count of the address at the current block. Other than that will be to predict the future.
    – Jaime
    Commented Jun 6, 2018 at 11:57
  • 1
    @Shubham Most functions in web3 accept an extra argument with the target block. You can use 'pending' like this web3.eth.getTransactionCount(address, 'pending') it will return the count including those pending transactions.
    – Ismael
    Commented Jun 6, 2018 at 15:33

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.