Question: How can I get some ether in Ethereum testnet/dev or even private blockchain?

I'm totally confused. If I use a customized genesis block like this:

"config": {
    "chainId":123 ,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0

"nonce": "0x0000000000000042",     "timestamp": "0x0",
"extraData": "0x00",     "gasLimit": "0x8000000",     "difficulty": 
 "coinbase": "0x3333333333333333333333333333333333333333",



Then if I do

geth --datadir ~/.ethereum_private init ~/CustomGenesis.json 

this error appears:

   Fatal: Failed to write genesis block: database already contains an 
   incompatible genesis block (have 6650a0ac6c5e8054, new 

If I leave the "alloc" field empty the error would not show up anymore (but I don't have any ether).

The other option to get some ether is to mine:


But if I do that, null appears. So, I cannot get any ether again.

We don't have this kind of problems when we're using truffle + testrpc. As it allocates ether to all the accounts we create.

So I don't know how I can get some ether in Ethereum testnet/dev or even private blockchain.


You cannot change the genesis parameters from already initialized the private blockchain.

You have to reset the blockchain eliminating any previous transaction.

geth --datadir <your_data_directory> removedb

And then you can execute

geth --datadir <your_data_directory> init <your_genesis_file>

To create a private blockchain with balance ether.

Save the below code in genesis.json

"config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
"nonce": "0x0000000000000042",
"difficulty": "0x40",
"gasLimit": "21000000000000000",
"alloc": {
    "0x95490e50a8b43348fa198bad08d4de211fb2b887": { "balance": "100000000000000000000000000" },
    "0xa4f6f95b6cb36025dd09c9f5fe068e401951e963": { "balance": "10000000000000000000" }


Initialise the node us

geth --datadir "node1" init "/path/to/genesis.json"

Then get into the java console using

geth --datadir "node1" --rpc console

In java console create the coinbase account using


Method 1:

Then start the mining process using


Now you can check the balance using


You can able to find the balance

Method 2:

After creating the account copy the account address and close the java console. Then delete the keystore file under node1 folder using

rm -rf `ls | grep -v keystore`

Then replace the account address with the copied one and balances as you wish in the genesis.json file. Then again initialise the node1 using

geth --datadir "node1" init "/path/to/genesis.json"

Connect to the java console and query the balance, now you will have the balance as you mentioned in genesis.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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