5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

geth init で Failed to write genesis block: database already contains an incompatible genesis block

Posted at

環境

geth 1.8.20-stable

事象と解決方法

下記のようなエラーになってしまう場合

$ geth --datadir ~/eth_private_net init ~/eth_private_net/myGenesis.json
(略)
Fatal: Failed to write genesis block: database already contains an incompatible genesis block
(略)

databaseを削除した後に init すれば良い(databaseを削除しても良いならば)。

$ geth removedb --datadir ~/eth_private_net
(略)
Remove this database? [y/N] y
(略)
Remove this database? [y/N] y
(略)
$ geth --datadir ~/eth_private_net init ~/eth_private_net/myGenesis.json
(略)
INFO [01-06|09:33:07.340] Successfully wrote genesis state
(略)

例えば、geth init の引数のjsonファイル(新しい genesis block の設定ファイル)で、"alloc" 等を編集して、再度 geth init する場合は、今回のケースに該当する。

myGenesis.json
(略)
  "alloc": {
    "0x0cbce0f758799e2e849eb2508cc9b2dfed3a7536" : {
      "balance": "1000"
    }
  }
(略)

参考

go-ethereum#14352 Custom Genesis file working anyone? I'm always getting "wrong genesis block in database"

5
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?