3

When we are making any transaction then we need gas for every transaction so how much gas I fixed to making successful transactions because sometimes the transaction is successful, and sometimes it gives me an error:

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

exports.sendTransactions = (sender_account, to_account, p_key, value ) => { console.log("sendTRansactions", sender_account, to_account , p_key , value ); var admin = sender_account; var contract_address = to_account; var tx = { from: admin, to: contract_address, gas: 184000, data: "", value: value }; return web3.eth.accounts.signTransaction(tx, p_key).then((hash) => { return web3.eth.sendSignedTransaction(hash.rawTransaction).then((receipt) => { return receipt }, (error) => { return error console.log(error); // reject(500); }) }, (error) => { return error // reject(500); }); } 
1

1 Answer 1

2

I just made gas is in string example: gas: '184000',

and it working for me.

Sign up to request clarification or add additional context in comments.

1 Comment

This doesn't explain the cause of the error.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.