5

I'm using geth to setup a private chain using the online tutorials, which apparently need some work. I'm starting up using the following command:

geth --identity "bingo" --rpc --rpcport "8000" --rpccorsdomain "*" --datadir "d:\block\data" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" console init "d:\block\CustomGenesis.json"

I've created three accounts. Then deleted everything in the data folder except the keystore and edited the genesis file.

{
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x4000",   
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "Custom",
"gasLimit": "0xffffffff",
"alloc": {
  "0x638f1d36516846821d145dd19f84bb2fe025cce5":{
     "balance":"100"
  }
 }
}

It's based on another answer and explained in this blog: https://lightrains.com/blogs/setup-local-ethereum-blockchain-private-testnet.

I'm unable however to get any ether on any account.

checkAllBalances();
eth.accounts[0]:      0xa9a017c171782a64d2eaa4c963347a67701415fb      balance: 0 ether
eth.accounts[1]:      0x638f1d36516846821d145dd19f84bb2fe025cce5      balance: 0 ether
eth.accounts[2]:      0x7c2cc3849338f9b7102a948143c179b5345bd0e0      balance: 0 ether
Total balance: 0 ether

The javascript comes from here https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts#checking-account-balances

EDIT: It appears the genesis file is just ignored. Referencing a file that not exists or an incorrect one gives no error at all.

3 Answers 3

2

it is not a problem with the balance, You need to reinitialize your blockchain with your new genesis block so run your previous command but put init before console. the idea is to rerun the init option in the second time otherwise your genesis file is ignored.

run geth --datadir "d:\block\data" init "d:\block\CustomGenesis.json console"

2

Your genesis file allocates 100 wei to account 0x638f1d36516846821d145dd19f84bb2fe025cce5 - which is so close to zero as to be a rounding error. 1 ether is 1e18 wei.

3
  • assigning "10000000000000000000" yields the same result
    – BennyM
    Nov 23, 2016 at 20:18
  • 1
    it appears the genesis file is completely ignored
    – BennyM
    Nov 23, 2016 at 20:35
  • Why would any amount of wei be rounded off?
    – scry
    Sep 18, 2020 at 19:33
1

I was mixing commands. You can not use console and init in one go.

Use:

geth --identity "bingo" --rpc --rpcport "8000" --rpccorsdomain "*" --datadir "d:\block\data" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" init "d:\block\CustomGenesis.json"

then:

geth --identity "bingo" --rpc --rpcport "8000" --rpccorsdomain "*" --datadir "d:\block\data" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" console

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.