Hi, I’ve already asked this before on this topic but the same issue is happening again. This time, it only happens with wallets created by Web3Auth. 3rd party wallets (such as MetaMask and Coinbase Wallet) are working fine.
I’ve tested with different accounts with enough ETH for gas on Ethereum Mainnet and Arbitrum, but I still receive the same error.
{
"jsonrpc": "2.0",
"id": "t0i4i298l4",
"error": {
"code": -32000,
"message": "insufficient funds for gas * price + value: address 0xF0b13b30E4F3F989a717E6c464dAcF8D438b3823 have 50000000000000000 want 2695404381981239840000000"
}
}
Hey, can you please the web3 package you are using to interact with blockchain? Also, which contract you are interacting with? We are a key management solution, so we don’t do the gas estimation. Also can share how are you doing the gas estimation?
What is intriguing to us is that the issue only happens if we sign in with any social or email account. If we sign in with a 3rd party wallet directly, everything works. Also, this solution was working fine until a few days ago.
The first thing I see is you are setting the maxTxnCostUsd hardcoded, along with gasLimit. For gas limit you should always do the runtime estimation using the API. You can checkout the docs here: web3.eth.Contract — web3.js 1.0.0 documentation
Same for maxTxnCostUsd, you can get the gasPrice on runtime using the RPC. For the 3rd party, they do calculate it for you, that’s why issue might not be happening.
Yeah, so I never reproduced the issue on testnet (sepolia and arbitrum sepolia). It was always on mainnet and with a wallet generated by Web3Auth.
However, I just updated the RPC to the one from Ankr and it worked.
How can that be possible? Since I was using a very well-known RPC.
Can I know the provider? I would like to test locally to find out the root cause of it. Additionally with Metamask and other similar wallets, the fallback is set to the Infura RPCs, there might be a chance that your particular RPC provider was not being used there as well.
Just following up. Is there a way to fallback the RPC with Web3Auth?
Also, would you know why I get Internal JSON-RPC error. when I call the estimateGas method?