-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insufficient funds for gas * price + value #1021
Comments
Try adding "from" field in your rawTx object : rawTx = {
from: yourPublicAddr
} |
This doesn't seem to make a difference. |
Right. I think that's because your forgot the "chainId" parameter : rawTx = {
chainId: 3
} let me know... |
This didn't make a difference. Btw. why do you need chainId? |
Is there any working example online? |
@win2win You now need chainId because it has become part of the signature (since the fork earlier this year. So many, forgot which one.) |
I gave the chain id. It didn't made any difference. Same Error :-( |
Even i am facing same issue. Code working fine with testrpc but getting gas related error when trying to deploy on Etherium blockchain |
In my case, I changed before"config": {
"chainId": 0,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
... after"config": {
"chainId": 42,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
... |
how I can specify the account which will pay for gas |
@hrachbkweb the sender is always the one to pay for the tx gas. There are proposals (e.g ethereum/EIPs#877) around this, but out of the box the sender is the payer. |
@iurimatias thanks for response .Is there any way to overcome this ? |
@guifel Could you add the JSON-RPC payload object which got send? This will help me to see the actual issue. |
@nivida The failed transaction with beta 48:
Note that I am not seeing the issue with beta 37. This is the successful transaction I get with it:
|
Have you solved it? I also want to implement A to transfer money to B, and then C pays gas, and I have private keys for A and C, or A is a contract that can create multiple wallet addresses. These addresses are used to receive tokens, and C is used as the contract of contract A. The only authority manager, C calls the contract to transfer tokens from the designated wallet and pay GAS |
I have lots of Ether in the account and have tried various accounts.
When I run this code below against testrpc, it completes successfully, but once I switch to my private geth or ropsten, this error shows consistently.
My version of geth is 1.6.7
I use Ubuntu 16.04.
This below is the code portion of the code which I'm running taken from the web3 examples
`var Web3 = require('web3');
var web3 = new Web3(
new Web3.providers.HttpProvider('http://localhost:8545/')
);
var key="xxx"
var Tx = require('ethereumjs-tx');
var privateKey = new Buffer(key, 'hex')
var bytecode ="6060604052341561000c57fe5b5b60a68061001b6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806339ec021c14603a575bfe5b3415604157fe5b6058600480803560ff16906020019091905050605a565b005b6000600082600a0a60ff16629896800262ffffff1691508190505b5050505600a165627a7a723058201aa083f84301acc104a3de0151822aa682702844181a821c16490689e05d729e0029";
var rawTx = {
nonce: "0x2",
gasLimit: "0x2DC6C0",
gasPrice: "0x4A817C800",
value: '0x00',
data: '0x' + bytecode
};
var tx = new Tx(rawTx);
tx.sign(privateKey);
var serializedTx = tx.serialize();
web3.eth.sendSignedTransaction( "0x" + serializedTx.toString('hex'))
.on('receipt', console.log);
`
Error shows like this.
Unhandled rejection Error: Returned error: insufficient funds for gas * price + value
at Object.ErrorResponse (/home/bogdan/node_modules/web3/packages/web3-core-helpers/src/errors.js:29:16)
at /home/bogdan/node_modules/web3/packages/web3-core-requestmanager/src/index.js:137:36
at XMLHttpRequest.request.onreadystatechange (/home/bogdan/node_modules/web3/packages/web3-providers-http/src/index.js:64:13)
at XMLHttpRequestEventTarget.dispatchEvent (/home/bogdan/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/bogdan/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/home/bogdan/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage. (/home/bogdan/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:469:24)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
The text was updated successfully, but these errors were encountered: