1

I created two accounts and for both the account addresses I provided them with some ether in a customised genesis.json. Then I ran the command

geth - datadir "/tmp/ethereum_dev_mode/" -dev unlock 0,1 -rpc -rpcaddr w.x.y.z -rpccorsdomain "*" -rpcport abcd init "/tmp/ethereum_dev_mode/genesis.json"

This command ran successfully and it created the custom genesis block, allocated cache and file handles ,wrote the genesis state,etc. then I ran the command geth -datadir "/tmp/ethereum_dev_mode/geth/" -fast console "/tmp/ethereum_dev_mode/genesis.json" -dev I got the following error-

Fatal: Error starting protocol stack: database already contains an incompatible genesis block (have 65e04841b69188e8, new e5be92145a301820)

Is is because of a customised genesis file? Even when using the customised genesis file, the init command ran successfully but starting the Dev console failed.

1

Because of genesis block initialized once. You had executed once, the infomation of genesis block was written to DB, but now you executed again, so this error occurred. the correct command is :

geth --datadir "/tmp/ethereum_dev_mode/geth/" --fast --dev console 

There is a clear judgment in go-ethereum source file, as follows:

// Check whether the genesis block is already written.
    if genesis != nil {
        block, _ := genesis.ToBlock()
        hash := block.Hash()
        if hash != stored {
            return genesis.Config, block.Hash(), &GenesisMismatchError{stored, hash}
        }
    }

Hope this help you~

2

Have a look at this question: How to use a customised Data Directory in Dev mode(private blockchain). DevMode enforces certain features like a specific genesis block, a specific data directory etc. Probably --dev is not what you want if you are trying to get your head around mining and smart contracts.

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.