I am using ethers.js to transfer erc20 token. How do I put nonce in transfer? Nonce can be any number?

| improve this question | | | | |
  • "Nonce can be any number?" - No, it has to be equal to the number of transaction executed with your account so far, which you can get, for example, using web3.js function web3.eth.getTransactionCount(account). For the other two questions, please open the offiial documentation of ethers.js and find out. – goodvibration Mar 16 at 15:35

Nonce is the number of transactions associated with the address you're using - accounts start at 0, contracts start at 1.

| improve this answer | | | | |
  • Can I give the nonce freely? – Louis Mar 17 at 3:47
  • No, as I said in my anser, it's the amount of transactions associated with your account, i.e. you cannot send a trx with nonce 3 if you haven't already sent transactions with nonces 0,1, and 2. – Nicolas Schapeler Mar 17 at 10:29

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