'how to adjust ethereum transaction's nonce

In the process of developing the ethereum dapp, I tested the load and there was a nonce error. When building a rawTx, I used web3.getTransactionCount("accountAddress", 'pending') as the nonce of the transaction. I didn't think there was going to be a nonce error, because I didn't use web3.getTransactionCount("accountAddress") as the nonce of the transaction, but it happened. I wonder how to handle it.



Solution 1:[1]

You are doing it correct. The question lacks context information to tell what could be wrong.

Solution 2:[2]

You are missing eth object call after web3 and don't forget await key word

await web3.eth.getTransactionCount('address', 'pending')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mikko Ohtamaa
Solution 2