Im using "web3": "^1.0.0-beta.37"
And I want to understand How can I send rawTransaction
My code is:
const pk = 'xxxxxxx';
const rawTransaction = {
"to": "0xa53709839ab6Da3ad9c1518Ed39a4a0fFCbA3684",
"value": web3.utils.toWei('1', 'wei'),
"gas": 2000000,
"chainId": 3
};
let signedTx = await web3.eth.accounts.signTransaction(rawTransaction, pk).catch(console.dir);
let sendTx = await web3.eth.sendSignedTransaction(signedTx.rawTransaction).catch(console.error);
My account has 4Eth (on ropsten) and my httpProvider is ropsten (using infura)
but I get this error
Error: Returned error: insufficient funds for gas * price + value
I follow:
and then
https://web3js.readthedocs.io/en/1.0/web3-eth.html#eth-sendsignedtransaction
toWei
supports decimal numbers - just to be sure use only integers. Check details: web3js.readthedocs.io/en/1.0/web3-utils.html#toweifrom
field is missing in your raw transaction?, Try adding it and run.