0

I have tried adjusting the Gas Limit and GWEI and I get this error. I am using infura and Ropsten. Has anyone any ideas about this?

Code -

        var rawTransaction = {"from":myAddress,
        "gasPrice":web3js.toHex(2*1e9),
        "gasLimit":web3js.toHex(7920027),
        "to":contractAddress,
        "value":"0x0",
        "data":contract.addBonus.getData(bonusType, target, year, month, day, token, bonus, bonusName, ineq),
        "nonce":nounce}

        console.log("raw txn " + rawTransaction);
        //creating tranaction via ethereumjs-tx
        var transaction = new Tx(rawTransaction);
        //signing transaction with private key
        transaction.sign(privateKey);
        //sending transacton via web3js module
    //    web3js.eth.sendRawTransaction('0x'+transaction.serialize().toString('hex'))
    //    .on('transactionHash',console.log);

       var serializedTx = transaction.serialize();

       web3js.eth.sendRawTransaction('0x'+serializedTx.toString('hex'), function(err, hash) {
       if (!err)
          console.log("hash = " + hash);
       else console.log("err = " + err);
       });

I get this error -

err = Error: insufficient funds for gas * price + value

1

Key was wrong - I corrected the key and now it runs.

1

This is probably not the case here since you're using Infura, but in case others are seeing this error when submitting transactions to a light node:
If the light node has no peers to ask about chain state, it may return this error since it can't determine the balance of the sender, and thus considers it insufficient.

  • The key was incorrect. I already corrected it. – Trevor Lee Oakley Oct 18 '18 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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