0

As I read, getTransactionCount() returns the number of transactions sent from an address. Which of below items should I consider?

  1. Not to use returned nonce?
  2. Use the returned nonce number as a parameter in sendTransaction() to avoid duplicate transactions?
  3. Use the returned nonce number + 1 to avoid duplicate transactions?
0

In order to avoid the problem of double-spending, each transaction is sent with a nonce.

What is a nonce?

A nonce is an integer value that represents the number of transactions that have been performed from an account (ethereum adddress).

Which of the below items should I consider?

  1. Not to use returned nonce?

You should not use this, as some transaction with this nonce has already been submitted to the network.

  1. Use the returned nonce number as a parameter in sendTransaction() to avoid duplicate transactions?

No, the reason is same as that of point 1

  1. Use the returned nonce number + 1 to avoid duplicate transactions?

Yes

| improve this answer | |
  • This is wrong! Nonce start at zero. You have to use the value that getTransactionCount returns. – Ismael Apr 4 at 17:33
0

Use the returned nonce number + 1 to avoid duplicate transactions

| improve this answer | |
  • Provide a bit of explanation about the answer, always. – balajipachai Mar 29 at 8:58
  • This is wrong! Nonce start at zero. You have to use the value that getTransactionCount returns. – Ismael Mar 31 at 3:56

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