Back to All

Error: Returned error: insufficient funds for gas * price + value

Hello,
I've to return on an existing project i wrote 9 months ago... but now that I've switched to goerli testnet I got an error regarding the price...
I've done a getBalance and I've got '200000000000000000' wei balance (0.2ETH)

The error code occurs during the sign of the transaction

var nftContract = new web3.eth.Contract(contract.abi, blockChainAddress);

var gasEstimate =await  nftContract.methods.mintNFT(publicKey, metadataUri).estimateGas();

var contractData = nftContract.methods.mintNFT(publicKey, metadataUri).encodeABI();
//the transaction
const tx = {
  from: publicKey,
  to: blockChainAddress,
  nonce: nonceToUse,
  gas: gasEstimate,
  data: contractData
}

try {
  var signPromise = await web3.eth.accounts.signTransaction(tx, privateKey);

  await web3.eth.sendSignedTransaction(
    signPromise.rawTransaction);  ///<---- here

  console.info("updating Token: " + token);
  await updateMintInfomation(token, signPromise.transactionHash, nonceToUse, 'IN_PROGRESS', userToken);

  await sleep(waitTimeout); //This is used to wait that the promise has been sent

  console.info("The mint function has completed. Waiting for Blockchain response");


} catch (err) {
  console.log(err);
  throw err;
}

The estimateGasFee is 23400, what can I check please?
Thanks

ReadMe