1

I am setting up a private ethereum testnet using geth. this is the genesis file.my question is when i create new accounts using personal.newAccount() command do i have to replace these addresses with the new ones ? and initialize the json file again?

i have already tried running this file and the mining starts but the account balance does not go up.

{
   "config": {
      "chainId": 1994,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   },
   "difficulty": "400",
   "gasLimit": "2000000",
   "alloc": {
      "7b684d27167d208c66584ece7f09d8bc8f86ffff": { 
          "balance": "100000000000000000000000" 
      },
      "ae13d41d66af28380c7af6d825ab557eb271ffff": { 
          "balance": "120000000000000000000000" 
      }
   }
}

The mining thread gets killed and connection from geth java console times out.

realr
  • 3,652
  • 6
  • 23
  • 34
happy2
  • 11
  • 2

1 Answers1

0

By defining these addresses in the genesis file, the addresses are not generated as accounts, only pre-funded. I would recommend you to generate 1-2 accounts and use these account addresses as the pre-funded addresses.

Regarding this: "i have already tried running this file and the mining starts but the account balance does not go up."

It doesn't increase because no mining address/account is specified. In your case, after starting miner.start(), the mining process is killed, because no etherbase/coinbase account is specified. Normally the etherbase/coinbase will be assigned to the first account. If you don't want to create an account, an assignment of the etherbase is necessary. I assume that something like this is thrown:

Error: etherbase missing: etherbase address must be explicitly specified

You can set the address via this command: miner.setEtherbase("7b684d27167d208c66584ece7f09d8bc8f86ffff")

All in all you have two options:

  • Create an account and use this as your etherbase
  • Assign the etherbase to your prefunded address

By creating an account, the etherbase will be automatically assigned to this account. I hope, I could help you.

MiDa
  • 225
  • 3
  • 14