1

I tried geth in a private network, and when I tried sendTransaction, it was failed saying "Error: insufficient funds for gas * price + value".

But the balance of accounts[0] is 4785 ether and it seems sufficient.

web3.fromWei(eth.getBalance(eth.accounts[0]), "ether")
4785

The command I tried is

eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(1, "ether"), gas: 1})

The genesis json file is

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

geth version: 1.7.1

Does anyone know what is wrong?

moriteru
  • 70
  • 6

1 Answers1

2

I've solved the problem by myself. The reason is that the chainId is 0. When I set chainId 8888, it worked fine.

moriteru
  • 70
  • 6