1

I am using Infura for Mainnet/Testnet and connect web3.js API from browser. The problem is that Infura is showing around 10 transactions less than what I see in etherscan. I want to know total transaction to calculate nonce.

Now, I am aware that there might be syncing issue in Infura temporarily. But, It seems it has latest block as Etherscan

Infura Current Block

Ether Scan Current Block

I am using web3.eth.getTransactionCount() function to get Total Transactions of an address.

Any thoughts on this will be appreciated.

2

web3.eth.getTransactionCount() returns the number of outbound transactions for an account. (This is the correct number to use for the nonce.)

If you're just looking at the UI on Etherscan, e.g. etherscan.io/address/0x..., you'll see the total number of inbound and outbound transactions involving that address.

2

Adding to what @smarx said... It is always better to have an alternative to an API like Infura. The reason is that there might be some delays in syncing, which can cause delays in transactions.

If possible, use a synced local node so that, at any time, you can switch back and forth for the back-up mechanism to avoid this type of issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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