'insufficient funds for gas * price + value

I am attempting to broadcast a constructed transaction for rinkeby. Web3 seems to always return errors, sometimes for

insufficient funds for gas * price + value

and other times for

Gas limit too high

var Web3 = require("web3")
var web3 = new Web3("https://rinkeby.infura.io/TOKEN")
var privateKey =
  "PRIVATE_KEY"

var tx = {
  chainId: 4,
  from: "22dd8860db83a962e8d2ec734eae62fab63e73ae",
  gas: "128028",
  gasPrice: web3.utils.toWei("0.00000002", "ether"),
  nonce: "0x0",
  to: "0x8a09e76a5255E3d07854647f4DBef7323F98323d",
  value: web3.utils.toWei(".000001", "ether")
}

var signed = web3.eth.accounts.signTransaction(tx, privateKey)
web3.eth.sendSignedTransaction(signed.rawTransaction).then(console.log)

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



Solution 1:[1]

Check your gas price .

The error is caused when your final calculated gas price + value (amount you intend to transfer) is greater than the amount of ether you have in your account.

So the possible solution are

i) check your gas price it may be absurdly high (probably by mistake)
ii) If you are in test network add ethers to your account, or same in main net.

Solution 2:[2]

The error is likely due to an insufficiency of ETH in your rinkeby test-net wallet. I recommend using a faucet to add eth to the wallet.

I used this one: https://rinkebyfaucet.com/

Good luck.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tharzeez
Solution 2 Adam