I have been chacking around the site for possible solutions but i havent found any that would solve my (probably most basic) error. The account from which i'm sending has around 1 ether and i'm certain that the private key is correct as i had generated a new one and sent ether to it specificly to test is i had incorrect private key. I am using ropsten test network. And possible help would be much appreciated. this is the full source code.

I had written smartcontract, i can call the methods from it, but for the life of me i cannot send a transaction anywhere.

var Tx = require('ethereumjs-tx').Transaction;
const Web3 = require('web3')
const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/da1b------341c38904ac78bb649502"))

const rawTransaction = {
        from : '0x76a9CEA17DbA8a371944d00a2E9A17AA3669B392',
        to: '0x17eB191cDc2b3f06c25914c2da041CEeb41e9B16',
        value: web3.utils.toWei("0.0001", "ether"),
        gasLimit: 200000,
        gasPrice: web3.utils.toWei("0.000002", "ether"),
        chainid : 3,
        network_id: 3

  .then(signedTx => web3.eth.sendSignedTransaction(signedTx.rawTransaction))
  .then(receipt => console.log("Transaction receipt: ", receipt))
  .catch(err => console.error(err));

The error being thrown :

Error: Returned error: insufficient funds for gas * price + value
    at Object.ErrorResponse (/home/ubuntu/ethereum_website/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/ubuntu/ethereum_website/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/ubuntu/ethereum_website/node_modules/web3-providers-http/src/index.js:96:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/ubuntu/ethereum_website/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/ubuntu/ethereum_website/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/ubuntu/ethereum_website/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/home/ubuntu/ethereum_website/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  • Typically this is caused by not being fully synchronized with the blockchain. Furthermore, Ropsten network has some issues due to the Istanbul test fork: coindesk.com/… Oct 10, 2019 at 14:02
  • @LauriPeltonen I had assumed that any synchronization with the network was to be done on the http provider's side? what exactly do i need to synchronize on my end? I'm not running any geth instance, because ii dont connect to it at any point. I can use method calls with no errors and get correct responses ( checking adress balance for example), but when it comes to actual transactions it fails. If there is a need to me to run geth i had not come across it in any of the tutorials.
    – Joze Jerse
    Oct 10, 2019 at 14:56
  • ah yes, sorry didn't notice you use Infura. So no synchronization is needed from you. Oct 10, 2019 at 16:53

1 Answer 1


I believe the issue is this line:

web3.utils.toWei(web3.utils.toWei("0.00000001", "ether"))

The inner call to web3.utils.toWei returns "10000000000". The outer call defaults to ether as a unit, so it multiplies that by 10**18 again, and you get "10000000000000000000000000000", which is 10,000,000,000 ether, certainly more than you have.

Drop the outer call to web3.utils.toWei, and I believe things should work for you.

  • although that certainly was an error, it did not solve my problem. i have updated the code and i still get the same error. even if i set the value to 1 wei i still get insufficient funds.
    – Joze Jerse
    Oct 10, 2019 at 16:53
  • Have you tried adding a 0x prefix to your private key? web3 tends to need the 0x prefix to get strings treated as hexadecimal.
    – user19510
    Oct 10, 2019 at 17:04
  • I cannot thank you enough, that was the problem.
    – Joze Jerse
    Oct 10, 2019 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.