Low Gas Transaction Fee

Hi, I’m getting error code:

"Error: Returned error: insufficient funds for gas * price + value. Even if I have remaining balance in my account.

It’s not clear why we are getting this error as the same code is working in ropsten, but It is not working for ethereum mainnet.

The below is the code that I’m using for sending out the money.

const txData = {
                nonce: web3.utils.numberToHex(nonce),
                gasPrice: web3.utils.numberToHex(networkGasPrice),
                gasLimit: web3.utils.numberToHex(gasLimit),
                to: config.consolidatorAddress,
                value: web3.utils.numberToHex(amountToSend),
                chainId: '0x01'
            }

Data that I’m getting

balance:  12392618660672459
networkGasPrice:  80000000000
gasLimit:  21000
 totalGas:  1680001000000000
amountToSend:  10712617660672459

Hi @chimeraTrijay, a couple questions. How are you getting the networkGasPrice? Checking ethgasstation.info, it should be around 15 Gwei right now. Also the gasLimit you’re setting is the absolute minimum for a tx.

If you’ve ran this once or more on mainnet and spent gas you’ll need to decrease the amountToSend, because the numbers you’ve listed would result in a 0 remaining balance. Any failed tx would decrease the available amountToSend