Forum

Goerli Testnet Faucet - error: insufficient funds for gas * price + value

Hello!

For a fun project, I wanted to set up my own Goerli testnet faucet. I was using the following code:

Everything is working great, but when I try to request goerli from my faucet I receive the following error:

{ Error: Returned error: insufficient funds for gas * price + value
    at Object.ErrorResponse (/home/vulture/goerli-faucet/node_modules/web3-core-helpers/lib/errors.js:28:19)
    at /home/vulture/goerli-faucet/node_modules/web3-core-requestmanager/lib/index.js:302:36
    at XMLHttpRequest.request.onreadystatechange (/home/vulture/goerli-faucet/node_modules/web3-providers-http/lib/index.js:98:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/vulture/goerli-faucet/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/vulture/goerli-faucet/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/vulture/goerli-faucet/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/vulture/goerli-faucet/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19) data: null }

I’ve tried adjust the config file gaslimit and milliethertotransfer as well as using hex, but the same error occurs. Here is the config file:

{
  "environment": "live",
  "debug": false,
  "Captcha": {
    "secret": "MySecretHere"
  },
  "Ethereum": {
    "milliEtherToTransfer": "1",
    "gasLimit": "30000",
    "live": {
      "rpc": "https://goerli-light.eth.linkpool.io/",
      "account": "MyEthAddress",
      "privateKey": "MyPrivKey"
    }
  }
}

My tx index.js has the following:

const gasPrice = web3.utils.toWei('0.00000002', 'ether')
                const gasPriceHex = web3.utils.toHex(gasPrice)
                const gasLimitHex = web3.utils.toHex(config.Ethereum.gasLimit)
                const nonce = await web3.eth.getTransactionCount(config.Ethereum[config.environment].account, "pending")
                const nonceHex = web3.utils.toHex(nonce)
                const BN = web3.utils.BN
                const ethToSend = web3.utils.toWei(new BN(config.Ethereum.milliEtherToTransfer), "milliether")
                const rawTx = {
                  nonce: nonceHex,
                  gasPrice: gasPriceHex,
                  gasLimit: gasLimitHex,
                  to: receiver,
                  value: ethToSend,
                  data: '0x00',
                  chainId: '5'

Does anyone have any thoughts?

Thanks!