Go-ethereum: Error: insufficient funds for gas * price + value

Created on 28 Jan 2018  路  3Comments  路  Source: ethereum/go-ethereum

Hi there,

I can not send transaction by Error: insufficient funds for gas * price + value
Please help me.

System information

Geth version: 1.8.0-unstable
OS & Version: OSX
Commit hash : 722bac84fa503199b9c485c1a3e2bfba03bc487d

Expected behaviour

$ geth --networkid 11 --nodiscover --maxpeers 0 --datadir ~/data_testnet console 2>> ~/data_testnet/geth.log

Welcome to the Geth JavaScript console!

instance: Geth/v1.8.0-unstable-722bac84/darwin-amd64/go1.9.3
coinbase: 0x3aabdf52f4b29276847f0a767410cf3cad3d228e
at block: 593 (Sun, 28 Jan 2018 21:08:20 JST)
 datadir: /Users/suzukikeita/data_testnet
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.getBalance(eth.accounts[0])
2.965e+21
> eth.getBalance(eth.accounts[1])
0
> eth.gasPrice
18000000000
> eth.getBalance(eth.accounts[0]) - 20000 * eth.gasPrice
2.9649996399999996e+21
> personal.unlockAccount(eth.accounts[0])
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("1", "ether")})

Actual behaviour

> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("1", "ether")})
Error: insufficient funds for gas * price + value
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("1", "ether"), gas:20000})
Error: insufficient funds for gas * price + value
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1

Steps to reproduce the behaviour

Backtrace

````
$ geth --networkid 11 --nodiscover --maxpeers 0 --datadir ~/data_testnet console 2>> ~/data_testnet/geth.log

Welcome to the Geth JavaScript console!

instance: Geth/v1.8.0-unstable-722bac84/darwin-amd64/go1.9.3
coinbase: 0x3aabdf52f4b29276847f0a767410cf3cad3d228e
at block: 593 (Sun, 28 Jan 2018 21:08:20 JST)
datadir: /Users/suzukikeita/data_testnet
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

eth.getBalance(eth.accounts[0])
2.965e+21
eth.getBalance(eth.accounts[1])
0
eth.gasPrice
18000000000
eth.getBalance(eth.accounts[0]) - 20000 * eth.gasPrice
2.9649996399999996e+21
personal.unlockAccount(eth.accounts[0])
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("1", "ether")})
Error: insufficient funds for gas * price + value
at web3.js:3143:20
at web3.js:6347:15
at web3.js:5081:36
at :1:1
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("1", "ether"), gas:20000})
Error: insufficient funds for gas * price + value
at web3.js:3143:20
at web3.js:6347:15
at web3.js:5081:36
at :1:1
````

Most helpful comment

@damirka
Thanks! I solved this.
I modified chainId on genesis.json. I changed chainId to the same value as --networkid 11.

```genesis.json

{
"config": {
"chainId": 11,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}


$ geth --datadir ~/data_testnet init ~/data_testnet/genesis.json
$ geth --networkid 11 --nodiscover --maxpeers 0 --datadir ~/data_testnet console 2>> ~/data_testnet/geth.log

personal.unlockAccount(eth.accounts[0])
true
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("0.1", "ether")})
"0x178d40ffeeaa30bbab397d038b1a88a91639ad0c57abdb5b19b63b1ae5dc83f4"
```

All 3 comments

@keitaj, I'm new to the Ethereum but answer I've found here has helped me. I'm working on my private network, I guess you too.

In short: change chainId param in your _genesis.json_ (or whatever you've called it). And don't forget to reinit geth nodes.

I have this to attempting to truffle migrate to Ropsten. How can I set genesis.json?

@damirka
Thanks! I solved this.
I modified chainId on genesis.json. I changed chainId to the same value as --networkid 11.

```genesis.json

{
"config": {
"chainId": 11,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}


$ geth --datadir ~/data_testnet init ~/data_testnet/genesis.json
$ geth --networkid 11 --nodiscover --maxpeers 0 --datadir ~/data_testnet console 2>> ~/data_testnet/geth.log

personal.unlockAccount(eth.accounts[0])
true
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei("0.1", "ether")})
"0x178d40ffeeaa30bbab397d038b1a88a91639ad0c57abdb5b19b63b1ae5dc83f4"
```

Was this page helpful?
0 / 5 - 0 ratings